docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DisallowRefReturnCrossingThisAttribute

    What is this : Attribute signaling that ref returned values, of a type that has this attribute, cannot intersect with calls to methods that also have this attribute. Motivation(s): ref returns of values that are backed by native memory (unsafe), like IComponentData in ecs chunks, can have the referenced memory invalidated by certain methods. A way is needed to detect these situations a compilation time to prevent accessing invalidated references. Notes:

    • This attribute is used/feeds a Static Analyzer at compilation time.
    • Attribute transfers with aggragations: struct A has this attribute, struct B has a field of type A; both A and B are concidered to have the attribute.
    Inheritance
    object
    Attribute
    DisallowRefReturnCrossingThisAttribute
    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    [AttributeUsage(AttributeTargets.Struct|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Interface)]
    public class DisallowRefReturnCrossingThisAttribute : Attribute
    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)