wave4-world-update-allocator-per-frame-native

Allocate per-frame NativeArrays via WorldUpdateAllocator in Unity DOTS.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave4-world-update-allocator-per-frame-native
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wave4-world-update-allocator-per-frame-native
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/wave4-world-update-allocator-per-frame-native
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave4-world-update-allocator-per-frame-native

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the hassle and risk of manually disposing per-frame Unity DOTS NativeArrays and NativeContainers, which otherwise lead to memory leaks or safety errors.

Core Features & Use Cases

  • Per-frame lifetime management: Uses WorldUpdateAllocator (RewindableAllocator) to auto-rewind allocations at the end of each world update.
  • No manual Dispose(): Keeps per-frame temporary job data allocation-safe without boilerplate disposal code.
  • Correct allocation strategy: Guides you on when to use rewindable per-frame memory versus Allocator.Persistent for cross-frame storage.
  • Use case: Allocate temporary maps/arrays inside an update to build job inputs for one frame, then safely let the allocator rewind without manual cleanup.

Quick Start

Use the WorldUpdateAllocator via state.WorldUpdateAllocator when creating NativeArray or NativeContainers for data that only needs to live for the current frame.

Frequently Asked Questions about wave4-world-update-allocator-per-frame-native

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I allocate temporary NativeArrays in Unity DOTS without manually calling Dispose()?

To allocate temporary NativeArrays without manual disposal, use the WorldUpdateAllocator (a RewindableAllocator) which automatically rewinds per-frame memory at the end of each world update cycle.

What is the WorldUpdateAllocator used for in Unity DOTS job pipelines?

The WorldUpdateAllocator is a RewindableAllocator used in Unity DOTS to manage per-frame temporary NativeContainers, providing safe scratch data for one frame inside OnUpdate without TempJob lifetime constraints.

When should I use a rewindable per-frame allocator instead of Allocator.Persistent in Unity DOTS?

Use a rewindable per-frame allocator like WorldUpdateAllocator for temporary data living only in the current frame, and use Allocator.Persistent for cross-frame storage to avoid memory leaks and disposal mistakes.

Can I use NativeContainers allocated with WorldUpdateAllocator across frame boundaries?

No, you cannot use NativeContainers allocated with WorldUpdateAllocator across frame boundaries because the world update rewinds the memory, rendering previous allocations invalid for subsequent frames.

Why does using WorldUpdateAllocator prevent memory leaks in Unity DOTS OnUpdate?

Using WorldUpdateAllocator prevents memory leaks in OnUpdate by automatically rewinding allocated memory at the end of the world update, eliminating the need for boilerplate manual disposal code.

Does WorldUpdateAllocator work with NativeContainers other than NativeArray?

Yes, WorldUpdateAllocator works with various NativeContainers beyond NativeArray, functioning as a RewindableAllocator that manages memory for any compatible Unity DOTS native container structure.