Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was gen

Here is a forum for reporting failure to Arbor developer.
Please read the forum rules carefully and enter the information necessary to confirm the problem.

Note:
  • Please read the "Update Guide" carefully when updating Arbor.
  • The bugs that we already know are summarized in "Known Issues", so please check once.
  • Please check ReleaseNote and use the latest version if possible before reporting a bug.
  • Unity beta and alpha versions are not supported. Please use the official release version.
  • In principle, defects caused by the introduction of other assets are not supported. If you find a defect, please report it after isolating which asset is the problem.

ここは、Arbor開発者へ不具合を報告するためのフォーラムです。
フォーラムルールをよく読み、不具合確認に必要な情報を記載するようお願いします。

注意点:
  • Arborを更新する際は「アップデートガイド」をよく読み行ってください。
  • 既に把握している不具合は「既知の問題」にまとめてありますので一度確認してみてください。
  • 不具合報告をする前にReleaseNoteを確認し、なるべく最新バージョンを使用して下さい。
  • Unityのベータ版およびアルファ版はサポート対象外です。正式リリース版をご利用ください。
  • 他アセット導入による不具合は原則サポート対象外です。不具合を見つけた場合はどのアセットの問題であるか切り分けた上でのご報告をお願いいたします。

Forum rules
The items necessary for reporting are as follows.
  • OS(Required)
  • Unity version(Required)
  • Arbor version(Required)
  • How to reproduce(Required)
    The reproduction method should be described accurately so that anyone can read the same procedure.
    If you do not know the exact reproduction procedure, as long as you can remember it, so please tell us what you were doing immediately before and the last time you edited it.
  • Build platform
  • Reproduction project (Minimum configuration not including Arbor and other assets) or video

Note:
  • Please read the "Update Guide" carefully when updating Arbor.
  • The bugs that we already know are summarized in "Known Issues", so please check once.
  • Please check ReleaseNote and use the latest version if possible before reporting a bug.
  • Unity beta and alpha versions are not supported. Please use the official release version.
  • In principle, defects caused by the introduction of other assets are not supported. If you find a defect, please report it after isolating which asset is the problem.

報告に必要な項目は以下の通りです。
  • OS(必須)
  • Unityバージョン(必須)
  • Arborバージョン(必須)
  • 再現方法(必須)
    再現方法については、誰が読んでも同様の手順を行えるよう正確に記述するようにお願いいたします。
    もし正確な再現手順が不明な場合、覚えている限りで構いませんので直前に行っていたことや最後に編集した時のことを教えてください。
  • ビルドプラットフォーム
  • 再現プロジェクト(Arborや他アセットなどを含まない最小構成)もしくは動画

注意点:
  • Arborを更新する際は「アップデートガイド」をよく読み行ってください。
  • 既に把握している不具合は「既知の問題」にまとめてありますので一度確認してみてください。
  • 不具合報告をする前にReleaseNoteを確認し、なるべく最新バージョンを使用して下さい。
  • Unityのベータ版およびアルファ版はサポート対象外です。正式リリース版をご利用ください。
  • 他アセット導入による不具合は原則サポート対象外です。不具合を見つけた場合はどのアセットの問題であるか切り分けた上でのご報告をお願いいたします。
ooee

Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was gen

Post by ooee »

いつもArborにはお世話になっています。
件名の不具合が発生したので、ご報告いたします。
お手数をおかけしますが、確認していただけると助かります。

OS: Windows10
Unityバージョン: 2020.1.6f1
Arborバージョン: 3.7.3
再現方法:
1. Events/InvokeMethodでVector3とToStringを選び、TargetにParameterContainerから取得したVector3パラメータを指定する。
2. Android IL2CPPでビルドし、Android実機で実行する。
3. Android Device MonitorでLogCatを確認すると、
ExecutionEngineException: Attempting to call method 'Arbor.DynamicReflection.DynamicUtility::ReboxValue<UnityEngine.Vector3>' for which no ahead of time (AOT) code was generated.
が表示される。

ビルドプラットフォーム: Android IL2CPP
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was

Post by caitsithware »

ご報告ありがとうございます。

事前コンパイルによるスクリプトの制限に引っかかってしまっていたようです。
https://docs.unity3d.com/ja/current/Man ... tions.html

回避策などが上記ページにも記載されておりますが今回のケースでもその方法で暫定対処できるのかなど、詳細についてはこれから検証いたします。
申し訳ございませんが、しばらくお待ちください。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was

Post by caitsithware »

https://docs.unity3d.com/ja/current/Man ... tions.html
こちらに記載されいてるUsedOnlyForAOTCodeGeneration()の方法で特定の型の呼び出しについては回避できることを確認いたしました。

早急な暫定対処が必要な場合は以下の方法をお試しください。
  • Assets/Plugins/Arbor/Internal/Scripts/DynamicReflection/DynamicUtility.csを開く。
  • 253行目あたり(DynamicUtilityクラスの末端)に以下のようなメソッドを追加。

    Code: Select all

    [Preserve]
    public static void UsedOnlyForAOTCodeGeneration()
    {
    	CastValue<Vector3>(new Vector3()); // 値型以外(クラスなど)の場合はCastClass<ClassType>(new ClassType());
    	GetDefault<Vector3>();
    	ReboxValue<Vector3>(new Vector3()); // 値型以外(クラスなど)の場合は不要。
    }
    
特定の型を指定しなくても問題がない方法については引き続き検証いたしますので、もうしばらくお待ちください。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was

Post by caitsithware »

DynamicUtilityのパッチを用意いたしました。
このパッチを適用していただければ、個別に型を指定することなく動作するかと思います。

また、他の箇所でもAOT関連の例外が発生しているのを確認いたしました。

詳しい内容やパッチについては下記ページを参照してください。
https://arbor.caitsithware.com/manual/issues/

ご不便おかけして申し訳ございませんが、修正までもうしばらくお待ちください。
ooee

Re: Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was

Post by ooee »

例外が発生していた手持ちのプロジェクトでパッチを当ててLogCatを確認したところ、
例外が発生しないのを確認しました。

対応していただき、ありがとうございました。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Android IL2CPPビルドにおいて、Events/InvokeMethodでパラメータに構造体があると実行時にExecutionEngineException: no ahead of time (AOT) code was

Post by caitsithware »

Arbor 3.7.4にて修正いたしました。
アセットストアから再DLし、リリースノートやreadme記載の更新手順に従って再インポートしてください。
Arbor 3.7.4 リリース | Arbor 3
Locked