i am triying to use the unity job system with marching cubes.
here is my job:
private struct UpdateChunksJob : IJobParallelFor
{
public NativeQueue<NativeChunk> queue;
public void Execute(int i)
{
queue.Dequeue().Chunk.UpdateChunk();
}
}
and the queue i am passing in:
public NativeQueue<NativeChunk> chunksToUpdate = new NativeQueue<NativeChunk>();
nativechunk is just a stuct referencing the class chunk:
public struct NativeChunk
{
public chunk Chunk;
public NativeChunk(chunk chnk)
{
Chunk = chnk;
}
}
but it is giving this error:
ArgumentException: NativeChunk used in native collection is not blittable, not primitive, or contains a type tagged as NativeContainer
Unity.Collections.CollectionHelper.CheckIsUnmanaged[T] () (at Library/PackageCache/com.unity.collections@1.2.4/Unity.Collections/CollectionHelper.cs:224)
Unity.Collections.NativeQueue`1[T]..ctor (Unity.Collections.AllocatorManager+AllocatorHandle allocator) (at Library/PackageCache/com.unity.collections@1.2.4/Unity.Collections/NativeQueue.cs:282)
worldgen..ctor () (at Assets/worldgen.cs:32)
another strange thing is that this code worked once and then stopped. please help. it would be so appreciated, i am new to jobs and really want to make a job loop over classes but it doesent work.