Vixen
02b45cc4
csharp
public sealed class PrefabAsset

A prefab, compiled. The instantiate plan doc 04 asks for, in a form that can be shipped.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The same content as a scene, with one root and a different life. A scene is loaded once and unloaded; a prefab is stamped out repeatedly, so what a game wants from this is not entities but a Prefab — the template world that makes an instantiation a row copy per archetype.

⚠ Building the template costs one instantiation, and that is deliberate. ToPrefab makes the entities in a staging world and captures them, so the asset carries no second description of what a template is and there is nothing to keep in step. It is paid once per prefab asset, at load, against every instantiation for the rest of the process — and the alternative, a capture format of its own, is a second serialiser for the same components with its own way of being subtly different.

Fields and properties (4)

  • public const int Current

    The version this build writes and reads.

  • public int Version

    Which version of the compiled form this is.

  • public string Name

    What the prefab is called.

  • public SceneContent Content

    Its entities, rooted in exactly one of them.

Methods (2)

  • public Prefab ToPrefab()

    Builds the template a game instantiates from.

  • public Entity Instantiate(World world, LocalTransform? at = null)

    Stamps out one instance, without keeping the template.

Used by (7)

  • SceneAssetTestsVixen.Engine.Tests
  • TypeRegistrationVixen.Engine
  • Vixen_Engine_Scenes_PrefabAssetSerializerVixen.Engine
  • CompiledSceneViewVixen.Editor.AssetEditors
  • SceneCompilerVixen.Editor.Assets
  • SceneImporterVixen.Editor.Assets
  • SceneImporterTestsVixen.Editor.Assets.Tests