diff --git a/src/StudioLaunchInitializer.cs b/src/StudioLaunchInitializer.cs index 842f17c..08d4b4d 100644 --- a/src/StudioLaunchInitializer.cs +++ b/src/StudioLaunchInitializer.cs @@ -29,13 +29,12 @@ namespace Cthangover.Mods.ScenarioStudio var layer = new StudioLayer(args); layer.Mount(); - var root = (Godot.Engine.GetMainLoop() as SceneTree)?.Root; - root?.CallDeferred("add_child", new StudioLive(layer)); + ModRoot.AddDeferred(new StudioLive(layer)); if (!args.Contains(Flag)) return; GameLogger.Log("UI", "Scenario studio: --studio given, the dock opens with the first scene"); - root?.CallDeferred("add_child", new StudioAutoOpenNode()); + ModRoot.AddDeferred(new StudioAutoOpenNode()); } } } diff --git a/test_suites/live/src/StudioLiveTestInitializer.cs b/test_suites/live/src/StudioLiveTestInitializer.cs index 84b3f27..714fa4f 100644 --- a/test_suites/live/src/StudioLiveTestInitializer.cs +++ b/test_suites/live/src/StudioLiveTestInitializer.cs @@ -35,7 +35,7 @@ namespace Cthangover.Mods.ScenarioStudio.Tests.Live driverQueued = true; GameLogger.Log("TEST", $"StudioLiveTestInitializer: activating studio live test, shots='{shots ?? ""}'"); - (Godot.Engine.GetMainLoop() as SceneTree)?.Root?.CallDeferred("add_child", new StudioLiveDriverNode(shots)); + ModRoot.AddDeferred(new StudioLiveDriverNode(shots)); } } }