実機でうまく動かないアプリがあってログを確認すると以下のようなエラーが出ていた。
Creating a serialization formatter for the type 'System.Collections.Generic.Dictionary
Please use Odin's AOT generation feature to generate an AOT dll before building, and MAKE SURE that all of the following types were automatically added to the supported types list after a scan (if they were not, please REPORT AN ISSUE with the details of which exact types the scan is missing and ADD THEM MANUALLY):
System.Collections.Generic.Dictionary
(name string: 'System.Collections.Generic.Dictionary`2[[EUserProperty, Assembly-CSharp],[UnityEngine.Sprite, UnityEngine.CoreModule]], mscorlib')
EUserProperty (name string: 'EUserProperty, Assembly-CSharp')
UnityEngine.Sprite (name string: 'UnityEngine.Sprite, UnityEngine.CoreModule')IF ALL THE TYPES ARE IN THE SUPPORT LIST AND YOU STILL GET THIS ERROR, PLEASE REPORT AN ISSUE.The exception contained the following message:
Attempting to call method 'Sirenix.Serialization.DictionaryForma
ExecutionEngineException: Attempting to call method 'Sirenix.Serialization.DictionaryFormatter`2[[EUserProperty, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[UnityEngine.Sprite, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::.cctor' for which no ahead of time (AOT) code was generated.
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
at Sirenix.Serialization.FormatterLocator.GetFormatterInstance (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Sirenix.Serialization.FormatterLocator.CreateFormatter (System.Type type, Sirenix.Serialization.ISerializationPolicy policy) [0x00000] in <00000000000000000000000000000000>:0
at Sirenix.Serialization.FormatterLocator.GetFormatter (System.Type type, S
丁寧に Please use Odin's AOT generation feature とあるので、それに従う。
Tools > Odin Inspector > Preferences > AOT Generation.
とたどっていくと、以下のような画面に、
ここにあるAutomate Before Builds にチェックを入れることでエラー対処できました。