entity-prefab-reference

Defer ECS prefab loading with EntityPrefabReference and explicit load requests.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid paying the memory and load-time cost of entity scene prefabs at world initialization by deferring prefab scene loading until you explicitly request it.

Core Features & Use Cases

  • Lazy prefab handle: Stores a deferred reference (EntityPrefabReference) instead of eagerly loading prefab roots during conversion.
  • One-shot async load flow: Uses a request/response pattern (RequestEntityPrefabLoadedPrefabLoadResult) so loading happens exactly once.
  • Safe spawn after completion: Spawns instantiated entities only after the loaded result is present, preventing premature access and runtime exceptions.

Use cases: enemy waves, VFX spawning, dynamically created gameplay content, and shared prefabs across multiple scenes/worlds where you want to minimize startup costs.

Quick Start

Ask your AI to implement EnemySpawnConfig with an EntityPrefabReference, add a one-shot request system that adds RequestEntityPrefabLoaded once, and a spawn system that waits for PrefabLoadResult before calling Instantiate using PrefabRoot.

Frequently Asked Questions about entity-prefab-reference

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

FAQPage Schema
How do I load Unity DOTS prefabs asynchronously at runtime instead of at startup?

To defer Unity DOTS prefab loading, bake an EntityPrefabReference, add RequestEntityPrefabLoaded to trigger the one-shot load request, and instantiate from PrefabLoadResult.PrefabRoot once the component is present.

Why does my ECS prefab spawn throw a runtime exception before the prefab is fully loaded?

Runtime exceptions occur when spawning before the prefab finishes loading. You must guard your spawn system to instantiate only after PrefabLoadResult is present, preventing premature access to the prefab root.

When should I use lazy ECS prefab streaming over eager loading in Unity DOTS?

Use lazy ECS prefab streaming for enemy waves, VFX spawning, and dynamically created gameplay content where you want to minimize startup memory and load-time costs across multiple scenes or worlds.

How do I dynamically spawn ECS entities from a deferred prefab reference in Unity?

Write a Baker that stores an EntityPrefabReference, add RequestEntityPrefabLoaded to the entity, then use a spawn system to call Instantiate from PrefabLoadResult.PrefabRoot after the load completes.

Does Unity DOTS support request and response patterns for prefab streaming?

Yes, Unity DOTS supports a request and response pattern for prefab streaming by adding RequestEntityPrefabLoaded to an entity and waiting for the PrefabLoadResult component to be populated before spawning.

What is needed to configure deferred prefab loading in a Unity DOTS Baker?

You need a Baker that writes an EntityPrefabReference to the entity instead of eagerly loading prefab roots, allowing the prefab handle to be streamed on demand at runtime.