So I got something really weird going on, I made an application for android, when I start the application in unity everything works fine. However when I build it to my android device it works sometimes. How can a application work sometimes…
Anyhow ofcourse I did some debugging and it seems it sometimes get stuck on a reference that I have on a custom dll imported in the asset folder. I have a server running that sends a List of custom objects to my unity application, in order to deserialize it properly I had to import my server application as dll into unity which I did. Now when I debug it with adb logcat, I can see it sometimes gets stuck on deserializing the object sent from the server but not always. I can start the app like 50 times and like 1 out of 50 it will work.
I have tried the following things:
- I have tried to change the API compatibility level from .net 2.0 subset to just .net 2.0
- on my dll build I changed the target framework to Unity 3.5 .net full base class libraries
- I have debugged my application running it on pc and no errors ever occur
The problem is not the tcpclient or server, because the connection is still there eventho it doesn’t receive the custom object properly.
I really about to give up, I don’t understand how it works sometimes, other times it doesn’t.
------edit------
I should probably mention the only warning I have in unity console is the following:
Serialization depth limit 7 exceeded at ‘Android_ChatRoomController::RunServer.lstclients’. There may be an object composition cycle in one or more of your serialized classes.
Android_ChatRoomController is the custom dll.
-----EDIT actual Logcat error:
TypeLoadException: Could not load type 'System.Collections.Generic.List`1[[Android_Cha
I/Unity (18811): at System.Type.GetType (System.String typeName, Boolean throwOnError) [0x00000] in :0
I/Unity (18811): at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo) [0x00000] in :0
I/Unity (18811): at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in :0
I/Unity (18811): at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in :0