RaycastPerformanceManager¶
Singleton manager for high-performance raycast batching using Unity Jobs.
Namespace: Jungle.Performance
Inherits: MonoBehaviour
Overview¶
RaycastPerformanceManager batches raycast requests into a single parallel RaycastCommand job each frame. It maintains persistent NativeArray buffers to avoid per-frame allocations and automatically resizes when capacity is exceeded.
Requires the JUNGLE_JOBS_ENABLED scripting define to compile.
The manager schedules jobs in Update() and completes them in LateUpdate(). Request raycasts early in the frame, read results after LateUpdate.
Static Members¶
| Member | Type | Description |
|---|---|---|
Instance |
RaycastPerformanceManager |
Auto-created singleton. |
IsReady |
bool |
True when the instance is initialized. |
Methods¶
| Method | Description |
|---|---|
RequestRaycast(Ray, float, int) |
Queues a raycast for the next batch. Returns a request ID. |
GetRaycastResult(int) |
Retrieves the RaycastHit for a previous request ID. |
ScheduleRaycastBatch() |
Schedules the batch job (called automatically in Update). |
CompleteRaycastBatch() |
Completes the job and makes results available (called in LateUpdate). |
ClearRaycastRequests() |
Resets requests for the next frame. |