Unity-Technologies / NativeRenderingPlugin

C++ Rendering Plugin example for Unity
https://docs.unity3d.com/Manual/NativePluginInterface.html
MIT License
814 stars 163 forks source link

Apple Silicon and Unity 2021.3.8f1 - DllNotFoundException: RenderingPlugin assembly:<unknown assembly> type:<unknown type> member:(null) #26

Open belveder79 opened 2 years ago

belveder79 commented 2 years ago

I can't get the plugin to load on Apple Silicon Unity:

arth@mbp: Plugins % lipo -i RenderingPlugin.dylib                                   
Architectures in the fat file: RenderingPlugin.dylib are: x86_64 arm64

I also tried with the .bundle instead of a dylib but no help. I had to remove the VALID_ARCHS user define from the xcode project in order to get arm64 into it, but whatever I do it is not loaded.

Am I missing something here?

linyouhui commented 2 years ago

Same problem, any solutions?

belveder79 commented 2 years ago

Not from my side. The weird thing is that I wrote some plugin based on this code some time ago and it actually loads, but does only render outside the editor on Silicon. So it seems that it works, but only if I build an app. Testing in the editor did not work for me...

SoylentGraham commented 1 year ago

I use .dylib, with a x64 & arm64 combined binary as you do. Make sure any cpu is selected in the meta/inspector of the dll in unity, otherwise it won't work.

In c# my dll import is libXYZ.dylib too, just to be clear (in a package)

DirkGummel commented 1 year ago

Hi, I have same problem, with Apple Silicon Metal, it doesnt work. I try Kejiro Texture Plugin -> works. What I have to do, to get this Plugin working. Is it work on the Editor ? Should I compile it with XCode, to build a ..... version ?

Any Explanation would be great

TienYoung commented 1 year ago

I have same problem, has any one solved it?

TienYoung commented 1 year ago

I can't get the plugin to load on Apple Silicon Unity:

arth@mbp: Plugins % lipo -i RenderingPlugin.dylib                                   
Architectures in the fat file: RenderingPlugin.dylib are: x86_64 arm64

I also tried with the .bundle instead of a dylib but no help. I had to remove the VALID_ARCHS user define from the xcode project in order to get arm64 into it, but whatever I do it is not loaded.

Am I missing something here?

Finally, I have succeeded, simply delete the VALID_ARCHS.

TienYoung commented 1 year ago

9ff79bb0a4eca5010462cdee1602316e29543ab2 Here is my commit. I just remove OpenGLES on macOS and iOS.

bvoq commented 10 months ago

9ff79bb Here is my commit. I just remove OpenGLES on macOS and iOS.

Thanks so much for this, it is working. Just build @TienAska NativePlugin in XCode, then open the Unity Project. Open the scene named scene in the asset folder, then navigate to File > Build Settings and click on: Add open scenes. After this click on build (Intel + apple silicon) and it works.

If you want select create a XCodeProj, then all you need to do is --deep to Other signing flags and it's running flawlessly or delete libRenderingPlugin.so and then it will also run flawlessly.