docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Field ImportEntity

    Optional main-world entity to copy into the per-section streaming world before Unity.Scenes.ProcessAfterLoadGroup runs.

    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    public Entity ImportEntity
    Returns
    Type Description
    Entity
    Remarks

    Use this to deliver per-instance runtime data to ProcessAfterLoad systems. Build a data entity in the main world carrying whatever components your ProcessAfterLoad system needs to read, then set ImportEntity on the scene meta entity (typically via Unity.Scenes.SceneSystem.LoadParameters.ImportEntity at load time). The streaming system copies that entity and all of its components into the section's loading world; ProcessAfterLoad systems then query for the imported components as if they were native to the streaming world.

    The imported entity follows the same lifetime rules as any other entity in the streaming world: your ProcessAfterLoad system may consume and destroy it, and any imported entity that is still alive after Unity.Scenes.ProcessAfterLoadGroup runs is tagged with SceneTag and moved into the main world together with the rest of the section's entities. Destroy it inside your ProcessAfterLoad system if you only want it to live for the duration of the load.

    You own the source entity in the main world; the streaming system only reads from it. Destroy the source entity yourself when it is no longer needed, but keep it alive until the scene load completes. ImportEntity may be Null, in which case no import is performed. A non-null reference to an entity that does not exist (because it was never created, or because it was destroyed before the scene finished loading) is treated as a programming error: the import is skipped and an error is logged.

    Because RequestSceneLoaded is automatically propagated from the scene meta entity to its sections, setting ImportEntity on the scene meta entity causes that entity to be imported into every section's streaming world. Override the per-section value by writing RequestSceneLoaded on the individual section meta entity if you need different (or no) import data for specific sections.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)