diff --git a/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyContext.cs b/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyContext.cs index abce6e9..8ea0f89 100644 --- a/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyContext.cs +++ b/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyContext.cs @@ -138,7 +138,7 @@ public Router Router public ICommandPublisher Publisher => Router; - public MRubyCommandPreset CommandPreset { get; set; } = default!; + public MRubyCommandPreset? CommandPreset { get; set; } public override bool IsInvalid => handle == IntPtr.Zero; Router? router; diff --git a/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyScript.cs b/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyScript.cs index 0fb9c6f..388394c 100644 --- a/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyScript.cs +++ b/src/VitalRouter.Unity/Assets/VitalRouter.MRuby/Runtime/MRubyScript.cs @@ -225,7 +225,7 @@ internal static unsafe void OnCommandCalled(int scriptId, MrbNString commandName { return; } - _ = script.Context.CommandPreset.CommandCallFromMrubyAsync(script, fixedCommandName, payload); + _ = script.Context.CommandPreset?.CommandCallFromMrubyAsync(script, fixedCommandName, payload); } catch (Exception ex) {