Skip to content

How should components be updated in the context of prefabs? #1200

Answered by copygirl
arcanis asked this question in Q&A
Discussion options

You must be logged in to vote

I believe you could add AlwaysOverride to Position to ensure an instantiated prefab gets its own copy of a Position component.

Or what I think might also work is to make sure the position term is marked with out or inout to ensure writes go to its own copy, not the shared component. I believe in C++ that would look something like .term_at(2).inout(). (Or .term_at(1) in Flecs v4, since they'll be zero-indexed going forward.)

I remember inout is the default for owned components, but in is the default for shared / inherited components. Though unsure how that's supposed to make sense for components that aren't defined as const in the system.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@arcanis
Comment options

@SanderMertens
Comment options

@arcanis
Comment options

@SanderMertens
Comment options

Answer selected by arcanis
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