Hi. I’m creating a Cellular Automata grid.
How to store a list inside a ComponentData?
My generation will increasy the size of the grid randomly later on.
I tried to hold a list of this struct inside a ComponentData, but “i’m hitting a wall”.
namespace Game.Map.Data {
public struct NodeData {
public MapNodeType Type; // this is an enum
public int X;
public int Y;
}
}
At first it solved my problem until i enable my second ComponentSystem.
When this system change another ComponentData, all the data set in DynamicBuffer disappear.
This buffer have a limitation per ComponentSystem or is it a glitch?
When i stop the ComponentSystem to change any field on any other componentData, the buffer stays in my entity, but if i change a field in any component i lose my buffer. I don’t know what to do.
Yes, after any structural change, the original pointer to the buffer becomes invalid. You can either use a EntityCommandBuffer like you said or use GetBuffer to grab the DB again.