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

SceneManager::findComponents does not work before mainloop has started #335

Open
ataulien opened this issue May 24, 2019 · 0 comments
Open
Labels
type: bug Something isn't working
Milestone

Comments

@ataulien
Copy link
Contributor

When calling SceneManager::findComponents before the game is acutally running, it will return an empty list, even though there are components of the type it should find in the world.

This is because these three vectors are empty:

Vector<HComponent> mActiveComponents;
Vector<HComponent> mInactiveComponents;
Vector<HComponent> mUninitializedComponents;

They are initialized in SceneManager::processStateChanges, which has not been called at that point, so all components added so far are still stuck in the mStateChanges vector.

A possible workaround is to call setComponentState, which will call processStateChanges internally like so:

bs::gSceneManager().setComponentState(bs::ComponentState::Paused);
bs::gSceneManager().setComponentState(bs::ComponentState::Running);

Then findComponents seems to work fine.

@BearishSun BearishSun added the type: bug Something isn't working label May 24, 2019
@BearishSun BearishSun added this to the v1.2 milestone May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants