toentityarray-snapshot-pattern
CommunityAvoid iterator invalidation during structural changes.
Software Engineering#ecs#entityquery#unity-dots#structural-change#iterator-invalidation#nativearrays#snapshot-pattern
AuthordyCuong03
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Prevents iterator invalidation and safety exceptions when iterating entity data while performing structural changes that may alter archetypes or entity state.
Core Features & Use Cases
- Safe iterate + structurally change workflow: Snapshot entity IDs and per-entity component data into NativeArrays before making structural changes.
- Per-entity conditional initialization: Use snapshot arrays to compute and write component data safely after structural changes.
- Main-thread ECS correctness: Applies to EntityQuery/SystemAPI patterns where batch structural operations are insufficient because each entity’s condition differs.
Quick Start
Ask the AI to “Generate a Unity DOTS system that snapshots matching entities with ToEntityArray and ToComponentDataArray, performs AddComponent/RemoveComponent on the query, then initializes per-entity data in a for-loop using the snapshot arrays.”
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: toentityarray-snapshot-pattern Download link: https://github.com/dyCuong03/unity-agent-team/archive/main.zip#toentityarray-snapshot-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.