TransformAccessArray lets Unity Jobs read and write GameObject transforms in parallel. Its key constraint is that a transform job processes every entry; it cannot select only the live objects that need updating. section 12.4
For a pooled enemy system, this means trading selective iteration over alive enemies for a full pass over pooled transforms. A reverse pool-to-enemy mapping identifies each transform’s enemy; a negative value marks an unused slot, which the job skips with a branch. section 12.4
A practical integration maintains the transform array and its reverse mapping together:
- Allocate the TransformAccessArray and native mapping array; initialize mapping entries to -1. section 12.4
- Add each newly instantiated enemy transform, and set both enemy-to-pool and pool-to-enemy mappings when assigning a pool object. section 12.4
- When enemies are removed, mark their pool mapping as -1; dispose the arrays when finished and clear transform entries when destroying the pool. section 12.4
Updating pooled enemy positions
A parallel transform job uses its pool index to look up the enemy index. If that index is valid, it reads the enemy’s position and writes it to the corresponding transform; unused pool entries are skipped. section 12.4
Figure 12.5 Every pool object has a corresponding entry in the TransformAccessArray. We need to run over all the elements in the array, so for each one we check if we have a valid pool index. The first one points to enemy index 1, so we use that enemy’s position to update the first transform in the access array. The second one points to -1, so we know it points to a dead enemy and we don’t have to update it. The third points to the enemy at index 0. Etc.

The figure traces how each pooled transform is checked and how a mapping of -1 identifies an entry that should not be updated. section 12.4
Use this approach only when updating GameObject transforms is a performance bottleneck: scheduling and waiting for the job adds overhead, and unused pool entries add iteration and branching. section 12.6
