-
-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Hello π
I'm getting the following error on 7.2.3 when running a game targeting Linux or Android (potentially iOS too) built with Unity 2021.3, IL2CPP as the scripting backend and IL2CPP Code Generation set to "Faster runtime":
System.ExecutionEngineException: Attempting to call method 'FlatSharp.Compiler.Generated.NC418A0549F80F471EB1C1156FF9E0B4B05EF63AD7CD33F898FED3AB3FA498AFC.Serializer::FlatSharp.Internal.IGeneratedSerializer<MyNamespace.Person>.ParseGreedyMutable<FlatSharp.ArrayInputBuffer>' for which no ahead of time (AOT) code was generated. Consider increasing the --generic-virtual-method-iterations=1 argument
at FlatSharp.ArrayInputBuffer.FlatSharp.IInputBuffer.InvokeGreedyMutableParse[TItem] (FlatSharp.Internal.IGeneratedSerializer`1[T] serializer, FlatSharp.Internal.GeneratedSerializerParseArguments& arguments) [0x00000] in <00000000000000000000000000000000>:0
at FlatSharp.GeneratedSerializerWrapper`1[T].Parse[TInputBuffer] (TInputBuffer buffer, System.Nullable`1[T] option) [0x00000] in <00000000000000000000000000000000>:0
at TestBehavior.Start () [0x00000] in <00000000000000000000000000000000>:0
So far I have tried:
- Increasing the
generic-virtual-method-iterationsto 5, 100 and 1000. - Adding [Preserve] to the generated Serializer class and its methods.
- Adding
FlatSharp.Runtimeto link.xml. - Using Newtonsoft.Json for Unity's AotHelper utility class to try and preserve generated classes.
- Making the generated Serializer public and invoking its __AotHelper method from a MonoBehavior that is in a scene that's never loaded, but is included in the build.
The current solutions I've found are:
- Using Mono as the scripting backend.
- Switching to Unity 2022.3 (it works even when IL2CPP Code Generation is set to "Faster runtime").
- Switching IL2CPP Code Generation to "Faster (smaller) builds".
Any help is greatly appreciated. π π
Related thread: https://forum.unity.com/threads/il2cpp-aot-exceptions-when-loading-subscenes-in-a-build.1198528/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels