I working on a 3D voxel planet game, based on octree.
I need some help with the following 2 things:
Now I save my data in a class which name is ChunkProfile but I am thinking about that I change class to struct, but I contain a lots of data in class so I do not know which is better?
And the other question is that I use Unity Job System or .NET Task parallel libarey?
Now i use Task base solution because I tried Job System but the Nativequeue does not want to work well and my project build on queues. How I read about job system is not a prefect solution to generate lots of chunks and mesh data.
My codes for the prototype:
I am thinking about that I change class to struct, but I contain a lots of data in class so I do not know which is better?
Structs are better when you need data locality to optimize cacheline use. Your ChunkProfile is rather big being about 100 bytes long (Vector3 is 12 bytes, for comparison).
I suggest you make that decision yourself. How? Think about how much of these 100 bytes your
foreach loops really make use of. Unused struct bytes represent cpu time wasted on reading them.
Note: managed object fields (like
List<T>) breaks data locality in structs.
And the other question is that I use Unity Job System or .NET Task parallel library?
Job system (or Entities) + Burst will be run faster. But rewriting your code will take at least few days up to few weeks (more realistically). Question is - do you even have such time for this and is it worth it?