docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Aspect concepts

    An aspect is an object-like wrapper that you can use to group together a subset of an entity's components into a single C# struct. Aspects are useful for organizing component code and simplifying queries in your systems. Unity provides predefined aspects for groups of related components or you can define your own with the IAspect interface.

    Aspects can include items such as the following:

    • A single Entity field to store the entity's ID
    • RefRW<T> and RefRO<T> fields to access component data of type T, where T implements IComponentData.
    • EnabledRefRW and EnabledRefRO fields to access the enabled state of components that implement IEnableableComponent.
    • DynamicBuffer<T> fields to access the buffer elements that implement IBufferElementData
    • Any ISharedComponent fields to access the shared component value as read-only.
    • Other aspect types

    Additional resources

    • Create an aspect
    • IAspect API documentation
    In This Article
    Back to top
    Copyright © 2024 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)