Skip to content
Discussion options

You must be logged in to vote

Use exclusive relationships with DontFragment and Exclusive traits (replaces deprecated Union). Create a state relationship: let state = world.entity().add_trait::<flecs::DontFragment>().add_trait::<flecs::Exclusive>(). Define state entities, then add states via entity.add_id((state, current_state)). The Exclusive trait automatically removes the previous state when you add a new one, enabling clean state transitions. See docs/ComponentTraits.md for details.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SanderMertens
Comment options

Answer selected by j-fdion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants