docs.unity.cn
    Show / Hide Table of Contents

    Tag components

    Tag components are unmanaged components that store no data and take up no space.

    Conceptually, tag components fulfil a similar purpose to GameObject tags and they're useful in queries because you can filter entities by whether they have a tag component. For example, you can use them alongside cleanup components and filter entities to perform cleanup.

    Create a tag component

    To create a tag component, create an unmanaged component without any properties.

    The following code sample shows a tag component:

    public struct ExampleTagComponent : IComponentData
    {
    
    }
    

    Additional resources

    • Unmanaged components
    • Cleanup components
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023