Class DisallowRefReturnCrossingThisAttribute | Entities | 0.10.0-preview.6
docs.unity3d.com
    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
    Syntax
    [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Interface)]
    public class DisallowRefReturnCrossingThisAttribute : Attribute, _Attribute
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023