#Burst UnmanagedCallersOnly

1 messages · Page 1 of 1 (latest)

astral lily
#

The burst 1.8.8 changelog mentions the UnmanagedCallersOnly attribute, which as far as I can tell it's only part of .net 5+. Is there a way to use this attribute in Unity? I'm currently using 2022.2 so i guess this might have been added in 2023?

naive quiver
errant depot
#

So the official answer is no, UnmanagedCallersOnly is not supported in Unity yet, even in Unity 2023 versions. With that said, it might work, let me explain:

We're currently working to bring CoreCLR and new .NET support to Unity. The UnmanagedCallersOnly attribute is a big part of that, allowing us to get excellent performance for code that crosses the native/managed boundary. So we are iteratively implementing support in Burst, IL2CPP, and Mono as we need it. Once there is a Unity release will full CoreCLR support, UnmanagedCallersOnly will also be fully supported. So you're seeing some implementation details of our current development work leak here. I would hold off until we have a full release though, as the current support is only what we need now, so there may be cases where it doesn't work completely.

light coral