DaVikingCode/UnityDetectHeadset

Build error on Android when changing Scripting Backend to il2cpp

StefanOber opened this issue · 2 comments

Hello,

I had to change to 64bit support and therefore to il2cpp Scripting Backend on Android.
Now cannot build anymore. I get the following error:
"Failed running il2cpp.exe" ... "error: undefined reference to '_Detect'".

This is because il2cpp supports plugins that are made in C++. By default, the plugins are compiled from java language in android.

More information can be found on unity documentation.

You can fix this by checking only running this on iOS:

#if UNITY_IOS && !UNITY_EDITOR
[DllImport ("__Internal")]
static private extern bool _Detect();
#endif