Why do I get a DllNotFoundException?

I built a macOS bundle that had been working fine in 2017.3.1. I upgraded to 2017.4.10, and now it doesn’t work anymore. I get a DllNotFoundException.

I tried rebuilding. I tried changing and saving the import settings, and restarting.

I am just running in the editor for now, but it also doesn’t work if I build the app. Just get a black screen, which is what I see in the editor, too, along with the exception.

The bundle is a small wrapper around a macOS framework. It’s open source. See Github/bgulanowski/BAFoundation, which includes the target BAFB.bundle.

This is in the Unity console:

DllNotFoundException: BAFB Utils..cctor () (at Assets/Scripts/Utils.cs:11) Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Utils HeightData..ctor (Vector2 off) (at Assets/Scripts/HeightData.cs:13) World+c__Iterator0.MoveNext () (at Assets/Scripts/World.cs:28) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) World:Start() (at Assets/Scripts/World.cs:55)

The Utils class is my entry point for the plugin routines.

That link you referenced gives a 404. Did you confirm that dll is in the plugins folders? Did you rebuild it against any dependent dll’s in the newer version of Unity? And, if using a mac platform, are you certain you have the correct port of the plugin (i.e a dll?)

Very late to get back to this, but wanted to close the loop.

Rebuilding the library using the Release scheme in Xcode (which includes all valid architectures), solved the problem. No changes otherwise to Unity or the Unity project.

It appears that at some point I built the plugin binary (in Xcode) using the debug scheme, instead of release. It seems that this did not include the correct architecture, and the Unity player could not successfully link it. Or that’s my best guess.

I have since switched from using a native plugin to using a compute shader for this particular task.