docs.unity3d.com
Search Results for

    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
    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)