diff --git a/src/gaemstone.Client/Systems/ImGuiManager.cs b/src/gaemstone.Client/Systems/ImGuiManager.cs index acd024d..6dc1d51 100644 --- a/src/gaemstone.Client/Systems/ImGuiManager.cs +++ b/src/gaemstone.Client/Systems/ImGuiManager.cs @@ -29,10 +29,7 @@ public partial class ImGuiManager [DependsOn] public struct ImGuiRenderPhase { } - // Start out disabled, because we first need to set it with a valid instance. - // TODO: Add a hint when a Singleton class is used without adding Disabled. - // TODO: Add a [Disabled] attribute as shortcut? - [Singleton, Add] + [Singleton] public class ImGuiData { public ImGuiController Controller { get; } @@ -91,7 +88,7 @@ public partial class ImGuiManager [DependsOn] public static unsafe void Initialize(World world, GameWindow window, Canvas canvas, [Source] InputContext inputContext, Not _) - => world.Entity().Enable().Set(new ImGuiData( + => world.Entity().Set(new ImGuiData( new(canvas.GL, window.Handle, inputContext.Value, () => { var io = ImGui.GetIO(); var style = ImGui.GetStyle(); diff --git a/src/gaemstone.SourceGen/ModuleGenerator.cs b/src/gaemstone.SourceGen/ModuleGenerator.cs index e4f3b6a..ec797cb 100644 --- a/src/gaemstone.SourceGen/ModuleGenerator.cs +++ b/src/gaemstone.SourceGen/ModuleGenerator.cs @@ -175,7 +175,10 @@ public class ModuleGenerator else sb.Append($".CreateLookup<{e.FullName}>()"); sb.AppendLine(); - if (e.IsSingleton) sb.AppendLine($"\t\t\t.Add<{e.FullName}>()"); + // I don't think it makes sense to have singletons pre-initialized to zero. + // Especially for singletons that are reference types, which would default to null. + // if (e.IsSingleton) sb.AppendLine($"\t\t\t.Add<{e.FullName}>()"); + // TODO: Look into if it would be possible to detect if we have field initializers. } sb.Insert(sb.Length - 1, ";");