#InstantiateInto

1 messages · Page 1 of 1 (latest)

last hearth
#

Trying to figure out how I could use something like this for my use case. I want to be able to swap an entity in place, similar to what tertle was mentioning. Specifically, I want to change the entity's archetype to match some prefab. It should remove components not on the prefab and any new components use the values from the prefab. For components that exist on both the old and new archetype, I want to sometimes keep the old value and sometimes use the new value. For example, I would like to keep the entity in the same position and orientation, but swap to the new mesh.

Thoughts on a good way to approach this?

slim pine
#

well, if there's only certain aspect you wan to copy, then why not just copy only it?
or if it's "excluding" way, then you might want to just cache values before using it

#

can also extend method

#

to support type filter

last hearth
#

I want the entity to switch the prefab's archetype. But yeah caching before and restoring or supplying a type filter could work.

#

Yeah I guess the thing I'm really trying to figure out is a clean way to set this up such that I don't have to enumerate a long list of types at the call site. So maybe something like attributes on the ICDs that register the types to either preserve or overwrite.

slim pine
#

you can just make a method

#

that copies data over components of your choice