Class NativePInvokeCallbackAttribute | DOTS Runtime | 0.31.0-preview.24
docs.unity3d.com
    Show / Hide Table of Contents

    Class NativePInvokeCallbackAttribute

    You likely don't want this attribute. This is an IL2CPP attribute to signify a pinvoke method is purely unmanaged and can thus be invoked directly from native code. As a result Marshal.GetFunctionPointerForDelegate(decoratedMethod) will not generate a reverse callback wrapper to attach to the managed VM. Do not use this attribute if your method requires managed data/types, doing so will result in undefined behaviour (almost certainly a crash at some point). Most users likely want to use [MonoPInvokeCallback] instead as that will handle all necessary managed type management when pinvoked.

    Inheritance
    Object
    Attribute
    NativePInvokeCallbackAttribute
    Namespace: Global Namespace
    Syntax
    public class NativePInvokeCallbackAttribute : Attribute, _Attribute
    Remarks

    This attribute is useful for passing delegates of Bursted functions from managed code into native code where they will be invoked. Without this attribute, IL2CPP will generate a reverse callback wrapper for invoking the managed delegate from native code and will attach to the VM, which is unsupported in DOTS Runtime from native threads.

    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