Interface ISystemStateComponentData | Entities | 0.10.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Interface ISystemStateComponentData

    An interface for a component type that stores system-specific data.

    Namespace: Unity.Entities
    Syntax
    public interface ISystemStateComponentData : IComponentData
    Remarks

    ISystemStateComponentData implementations are subject to the same constraints as IComponentData: they can only contain blittable data types.

    System state components are specialized components designed to allow systems to store their own stateful data on an entity. The functional difference between a general-purpose component and a system state component is that the presence of a system state component delays entity destruction until the system explicitly removes the component. This delay allows a system to cleanup any state or persistent resources it has created and associated with an entity.

    The typical pattern for using a system state component is for the system to find new entities by querying for entities with specific archetype, that do not have the component. The system can add a system state component to the entity and then set state values or create resources for the new entity. A system can then detect entity destruction by querying for entities that have the system state component, but not the other components in the original archetype. The system must then cleanup any state or resources and then remove the system state component. The ECS code only fully deletes the entity after the system removes the system state component.

    See System State Components for additional information.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023