I am getting this annoying bug but not sure why or how to fix it. I am trying to manipulate vertices with MeshDataArray.
This is what my code looks like:
//creates copy of mesh (apparently)
var data = Mesh.AllocateWritableMeshData(prefab);
//original - readonly
var inputVerts = data[0].GetVertexData<float3>();
//buffer we will work with
var newVerts = new NativeArray<float3>(inputVerts, Allocator.TempJob);
for (int i = 0; i < path.Length; i++)
{
//new mesh for each step along the path
var m = new Mesh();
//deform to conform to the path
new DeformJob<T>(inputVerts, newVerts, path, i).Schedule(inputVerts.Length, 64).Complete();
//set the changes and info to the new mesh we made
Mesh.ApplyAndDisposeWritableMeshData(data, m);
}
But i get this error:
Leak Detected : TempJob allocates 1 individual allocations.
InvalidOperationException: The UNKNOWN_OBJECT_TYPE DeformJob`1._input has been deallocated. All containers must be valid when scheduling a job.```
What am i getting wrong?