Open bmotamer opened 1 year ago
Unfortunately I'm not a game developer and don't have any experience with Unity, so I can't give you a lot of concrete guidance here. FlatSharp does try to emit a static AotHelper
method to give hints to AOT compilers about possible uses of generics.
I wish I could help more here since Unity devs seem to get lots of value out of FlatSharp. Are there any resources you could point me to to help reproduce the problem locally?
If you do manage to figure out the correct annotations for Unity, I'm also happy to adjust the FlatSharp codegen to accommodate.
Unfortunately I'm not a game developer and don't have any experience with Unity, so I can't give you a lot of concrete guidance here.
No worries! Even if we can't come up with a solution to this, I hope this issue helps others in a similar situation as me. :smile:
Are there any resources you could point me to to help reproduce the problem locally?
Steps to download the Unity Editor:
Steps to set up the test project:
Steps to open the test project with the Unity Editor:
Steps to make a build (and reproduce the issue):
The code in Assets/Scripts/TestBehavior.cs
loads the Assets/Content/Generated/Person.txt
file and updates the text displayed on screen during runtime.
The FlatSharp generated code is in Assets/Scripts/Generated/FlatSharp.generated.cs
.
Thanks for this! I will try to work through this as I have some time over the next week or so.
i use unity 2023.4.41f1 has the same .ExecutionEngineException: NotSupportAdjustorThunk
GameLogic.Network.FlatSharpNetwork.SendProto (FlatSharp.NetMessage clientMessage, System.Int32 channel) (at <00000000000000000000000000000000>:0)
GameCode.DlgLoginLogic.Login () (at <00000000000000000000000000000000>:0)
FlatSharp.GeneratedSerializerWrapper1[T].Write[TSpanWriter] (TSpanWriter writer, System.Span
1[T] destination, T item) (at <00000000000000000000000000000000>:0)
this code maybe cut .
[ExcludeFromCodeCoverage]
public static int Write
@bmotamer / @yingnierxiao any success with getting FlatSharp to work with Unity. For us it seems to work fine when targetting Windows, but when targetting iOs or Android we are getting errors
@njannink Try changing IL2CPP Code Generation
to Faster (smaller builds)
and/or Managed Stripping Level
to Minimal
if you haven't already.
Hello :wave:
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":
So far I have tried:
generic-virtual-method-iterations
to 5, 100 and 1000.FlatSharp.Runtime
to link.xml.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:
Switching IL2CPP Code Generation to "Faster (smaller) builds".
Any help is greatly appreciated. :bow: :pray:
Related thread: https://forum.unity.com/threads/il2cpp-aot-exceptions-when-loading-subscenes-in-a-build.1198528/