I need a way to store something like “time elapsed”, which would be unique to each “shared index”. Right now I have each individual entity store it in an attached IComponentData, but this seems wasteful as each entity will have the same time value as other entities belonging to the same “shared index” chunk.
I read this in the docs:
“SharedComponentData should change rarely. Changing a SharedComponentData involves using memcpy to copy all ComponentData for that entity into a different Chunk…”
So I definitely would not want to do that.
I couldn’t find much information about SetChunkComponentData, but perhaps it is what I need? If someone could point me to a thread or doc on what it is about, it would be much appreciated.
Or maybe there is a simpler way of doing this that I cannot think of?
Here is a brief to specifics of my situation, to maybe give a better picture:
- I have an ISharedComponentData, “SubordinateSpawner”, which contains the information on what prefab to spawn, where, and how often,etc…
- I have a system that operates on all entities that have it
- The system needs a “time elapsed” value that tells the system how long it has been since last spawn, and if it has been > rate then it instantiates a prefab, and resets it back to 0
- The “time elapsed” value needs to be unique to each different “SubordinateSpawner”, because the spawn rates may be different and thus the “time elapsed” should be reset at different times
Thank you all in advanced