Quick answer: Length(TransformAccessArray) == Length(data). Resize together; schedule sees consistent shape.
Job iterates over 100 transforms but velocity array has 99 entries. Schedule throws stride error.
The Fix
struct MoveJob : IJobParallelForTransform {
public NativeArray<float3> Velocities; // must equal transforms count
public float Dt;
public void Execute(int i, TransformAccess t) {
t.position += (Vector3)(Velocities[i] * Dt);
}
}
// schedule
Debug.Assert(transforms.length == velocities.Length);
var handle = new MoveJob { Velocities = velocities, Dt = Time.deltaTime }.Schedule(transforms);
If you remove a transform, also remove the matching velocity entry. Track via dictionary or pair them in a SoA struct array.
Verifying
Schedule succeeds. Mismatched intentionally: throws. Confirms the safety net.
“Same length. Same shape. Job runs.”
Related Issues
For NativeArray dispose, see dispose. For ReadOnly write, see readonly.
Lengths agree. Stride aligns.