Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameResources and GameObjectSystems are loaded multiple times while opening a project. #5431

Open
badandbest opened this issue Apr 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@badandbest
Copy link

Describe the bug

Game resources and game object systems load multiple times when you are opening a project.

To Reproduce

  1. 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}" );
        }
    }
  2. Open your project
    image

  3. They are loaded/created twice.
    image

  4. 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

Log.log

Project.zip

Additional context

No response

@badandbest badandbest added the bug Something isn't working label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

1 participant