Closed NguyenAnhDuc closed 1 year ago
Have try change setting the build settings in unity in IL2CPP from Faster runtime to Faster (Smaller) builds but still not work
I have developed a game with this package. it runs fine in the editor but it is not connecting from Android devices to the server (simulators/mobile devices). can anyone let me know the reason for this? is there any solution to this problem?
For me socket connections worked with IL2CPP, but Emits from mobile were broken. This was caused by IL2CPP breaking the JSON serializer that is used by default. Simply switching to the Newtonsoft option (that's already included) made it work on Android and iOS.
using SocketIOClient.Newtonsoft.Json;
socket = new SocketIOUnity( ... );
socket.JsonSerializer = new NewtonsoftJsonSerializer();
Thanks for the reply but still it's not working, is there any other setting needs to change to make it work?
@devalvitec Having the same issue. Did you find a solution?
Yes I got the solution @ArthurVanRemoortel , I just need to update the Unity version to 2022.3.10f1 and it works, also for 2021 version change the IL2CPP Code Generation to faster (smaller) build and then try. It should work.
The library does not work with IL2CPP, only works with Mono. Another person has also encountered a similar issue as me: https://stackoverflow.com/questions/59029987/how-to-prevent-code-stripping-with-il2cpp
To summarize: For Android, it only works when using Mono, not when using IL2CPP. For Apple/iOS, since they only accept IL2CPP, I see no way to make it work.