sbox-issues
sbox-issues copied to clipboard
GameResources and GameObjectSystems are loaded multiple times while opening a project.
Describe the bug
Game resources and game object systems load multiple times when you are opening a project.
To Reproduce
-
Create a GameObjectSystem and GameResource
public class MyGameSystem : GameObjectSystem { public MyGameSystem( Scene scene ) : base( scene ) { Listen( Stage.FinishUpdate, 10, DoSomething, "DoingSomething" ); } void DoSomething() { Log.Info( $"Did something!" ); // Only run once. Dispose(); } }[GameResource("My Game Resource", "test", "A game resource for testing.")] public class MyGameResource : GameResource { protected override void PostLoad() { Log.Info( $"Loaded {this}" ); } } -
Open your project
-
They are loaded/created twice.
-
Note that this is before I clicked play on the scene.
Expected behavior
A game resource should only be loaded once.
A game object system should only be created once per scene.
Media/Files
Additional context
No response