#Baking references between Entities

1 messages · Page 1 of 1 (latest)

young rock
#

Hiyo!
I've got a bunch of components on entities that each have a unique ID that I use to find them, so I'm looking to create a dictionary to do that.
I thought I might be able to create a baking system that performs a query and caches the lookup, but the entities I cache are those in the "Converted Scene" world, and when play mode comes around they're dumped into the "Default" world and my entity indices don't get remapped.
Is this just how it is? Do I need to perform this on startup instead of trying to make the references part of my subscene?
Or are there easy ways to get these values remapped? I'm very new to actually programming with entities so any insight is welcome!

earnest copper
#

Remapping only works on IComponentData and IBufferElement

#

Best bet is probably just fill a IBufferElement with your data and in an initialization system just build a hashmap from it

young rock
#

To clarify: remapping only targets Entity fields on those components?

earnest copper
#

yeah

young rock
#

and it's the NativeHashMap that I have on the IComponentData that the remapping system doesn't look into

earnest copper
#

nope (baking a native container will break in builds anyway)

young rock
#

Ah this is good to know. There are so many pitfalls for me to fall into!

earnest copper
#

structs with entity references that are on ICD/IBE will also remap fine