public void StartCrossfade(SnapshotMeshFrameData fromFrame, SnapshotMeshFrameData toFrame) { Reset(false); isReset = false; this.fromFrame = fromFrame; this.toFrame = toFrame; int vertexLength = fromFrame.verts.Length; if (positionJobs == null) { positionJobs = AllocatedArray <LerpVector3Job> .Get(framesNeeded); } if (boundsJobs == null) { boundsJobs = AllocatedArray <CalculateBoundsJob> .Get(framesNeeded); } if (positionJobHandles == null) { positionJobHandles = AllocatedArray <JobHandle> .Get(framesNeeded); } if (boundsJobHandles == null) { boundsJobHandles = AllocatedArray <JobHandle> .Get(framesNeeded); } if (output == null) { output = AllocatedArray <NativeArray <Vector3> > .Get(framesNeeded); } from = new NativeArray <Vector3>(vertexLength, Allocator.Persistent); to = new NativeArray <Vector3>(vertexLength, Allocator.Persistent); from.CopyFrom(fromFrame.verts); to.CopyFrom(toFrame.verts); for (int i = 0; i < framesNeeded; i++) { output[i] = new NativeArray <Vector3>(vertexLength, Allocator.Persistent); float delta = i / (float)framesNeeded; var lerpJob = new LerpVector3Job() { from = from, to = to, output = output[i], delta = delta }; positionJobs[i] = lerpJob; positionJobHandles[i] = lerpJob.Schedule(vertexLength, 64); var boundsJob = new CalculateBoundsJob() { positions = output[i] }; boundsJobs[i] = boundsJob; boundsJobHandles[i] = boundsJob.Schedule(positionJobHandles[i]); } }