Component play should not execute if the component is not initialized #1565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
There's a bogus situation if
playis called on a component that has not been yet initialized and the logic relies on something done in theinitmethod.The bug has manifested when the camera system pauses the inactive camera entity and plays the new active one. With the default camera the camera system calls play on the entity. The camera component is initialized before
look-controlsand itsplaymethod invoked beforeinit. Theplaymethod oflook-controlsexpects the methods to be bound before attaching the event listeners.Changes proposed:
Ensure that
playis never invoked beforeinitand also prevent play/pause logic to be executed multiple times if the component is already playing or paused respectively.