docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class OptionalAttribute

    When used on an aspect's ComponentDataRef field, marks that component type as optional.

    Inheritance
    object
    Attribute
    OptionalAttribute
    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    [AttributeUsage(AttributeTargets.Field)]
    public class OptionalAttribute : Attribute
    Remarks

    The DOTS source generator handles the generation of the query using this attribute. A ComponentDataRef may also be marked read-only by using the attribute [Unity.Collections.ReadOnly].

    This attribute is not intended to be used with DynamicBuffer<T> components.

    In This Article
    Back to top
    Copyright © 2025 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)