PhysicsStructuresComponent

A singleton component on the physics world entity that owns the native buffers used throughout the import → fixed-step → export pipeline. Bootstrap allocates every array to MaxEntitiesCount and stores the handles here; systems and custom job interfaces read the same instance each frame.

Prefer data from this component over per-entity component lookups inside the hot physics loop.

Fields

Field Type Page
BodiesList NativeArray<PhysicsBodyData> BodiesList
Randoms NativeArray<Random> Randoms
EntitiesMap NativeHashMap<Entity, uint> EntitiesMap
CollisionMap CollisionMapSingleton CollisionMapSingleton
Collisions CollisionsSingleton CollisionsSingleton

All NativeArray lengths equal the allocated pool size (MaxEntitiesCount). Parallel work and valid data use indices 0 … ActiveBodiesCount - 1 from SimulationDataComponent.

Lifecycle

Bootstrap     →  Allocate arrays; store handles on physics world entity
LateSimulation →  Import clears and refills BodiesList + EntitiesMap
FixedStep     →  Internal systems + user jobs read/write native buffers
Simulation    →  Export copies BodiesList back to ECS components
Shutdown      →  Bootstrap disposes native memory

Do not dispose or reassign these NativeArray fields from custom code. They are Allocator.Persistent and owned by bootstrap for the session.

Accessing the singleton

After PhysicsReadyTag is present:

var structures = SystemAPI.GetSingleton<PhysicsStructuresComponent>();

Custom jobs that touch shared buffers must combine with SimulationDataComponent.PhysicsJobHandle before scheduling. Package interfaces such as IBodiesJob, ICollisionJob, ISurfaceJob, and ILineCastJob accept PhysicsStructuresComponent and handle chaining through ScheduleAndChain.

See Custom jobs for interface details and group placement.


Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.