Skip to content

Comments

Check the isPlaying flag of the component when calling component behaviors#5516

Merged
dmarcos merged 1 commit intoaframevr:masterfrom
mrxz:fix-5515
Apr 10, 2024
Merged

Check the isPlaying flag of the component when calling component behaviors#5516
dmarcos merged 1 commit intoaframevr:masterfrom
mrxz:fix-5515

Conversation

@mrxz
Copy link
Contributor

@mrxz mrxz commented Apr 9, 2024

Description:
This PR fixes a regression introduced in #5478, which was noticed by @vincentfretin in #5515. In short, behaviours would be marked for removal when they belong to a component that is currently having their tick/tock called. This works fine in case an entity is removed or if the removed components have already been called, but fails if they are yet to be called.

This PR simply changes the check in callComponentBehaviors from .el.isPlaying to .isPlaying as components with behaviours have this flag. Generally it matches the .el.isPlaying state, unless the component hasn't (fully) initialized yet or is removed from an entity. Those are precisely the cases where the bug could surface.

The related unit tests required some changes in setup as they used Components that weren't completely initialized or inline defined behaviours.

Fixes/supersedes #5515

Changes proposed:

  • Only call tick and tock on components that are currently playing

@vincentfretin
Copy link
Contributor

Thanks @mrxz you're the best!
I'm glad I found the issue myself and not during a demo with my customer :D

@dmarcos
Copy link
Member

dmarcos commented Apr 10, 2024

Thanks so much!

@dmarcos dmarcos merged commit d8ef657 into aframevr:master Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants