Help us understand the problem. What is going on with this article?

ARKit2 UnitySDKを入れた状態でIL2CPPビルドするとエラーが出た時のメモ

ARKit2のUnitySDKとARCoreのUnitySDKを入れてマルチプラットフォームな環境を作ってた時につまづいたのでメモです。

IL2CPPのビルドにするとエラーが出る
スクリーンショット 2018-11-30 12.36.22.png
スクリーンショット 2018-11-30 12.42.50.png

Exception: /Applications/Unity/Hub/Editor/2018.2.16f1/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll did not run properly!
みたいなエラーが発生しました

ちなみにIL2CPPからMonoにした場合はちゃんとビルドが通る。

解決策
https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/issues/25/android-il2cpp-build-fail
調べたところissueが上がってました。
ARVideoFormat.csの

        #if UNITY_EDITOR
        private static void EnumerateVideoFormats(VideoFormatEnumerator videoFormatEnumerator) {
        }
        #else
        [DllImport("__Internal")]
        private static extern void EnumerateVideoFormats(VideoFormatEnumerator videoFormatEnumerator);
        #endif

ここを

        #if UNITY_EDITOR ||  !UNITY_IOS //こうする
        private static void EnumerateVideoFormats(VideoFormatEnumerator videoFormatEnumerator) {
        }
        #else
        [DllImport("__Internal")]
        private static extern void EnumerateVideoFormats(VideoFormatEnumerator videoFormatEnumerator);
        #endif

このようにプラットフォーム識別を変えてやると解決します。

ちなみに先ほど見たところ最新のコミットで修正対応されているようです。
https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/src/472ea0983dcd12a563e7c47a23d9bb405bdeb2a5/Assets/UnityARKitPlugin/Plugins/iOS/UnityARKit/NativeInterface/ARVideoFormat.cs?fileviewer=file-view-default
プロジェクトの都合がつくなら最新版持ってきた方が良さそうです。

治ってなかったです(2019年1月現在)
https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/pull-requests/57/fixed-define-in-arvideoformat-to-allow/diff
MRは出てた

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away