This is so weird, I can’t even explain it.
I’ve created an application to add some functionality to my unity game.
Everything works fine when I ran the same steps from unity.
The steps:
- Create a class.
- Convert it to JSON. (Using Newtonsoft.Json package)
- Add the converted class to another class as a member.
- convert that class to JSON as well
- run Encoding.UTF8.GetBNytes(json)
It works great when I copy the source files and run them via unity(in the editor), but every time I build it alone and add the DLL, unity raises an exception at the Byte convert stage (I know this because I have tried commenting out every part of the code, and that’s the only part that’s failing)
This is the error -
TypeLoadException: Could not resolve type with token 01000019 (from typeref, class/assembly System.Text.Encoding, System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
Client.CreatePlayer (System.String client, System.String id, System.String type, System.String teamId, System.Single[] location) (at <59a6b6b960504910bd482e9be83660f7>:0)
PlayerController.Start () (at Assets/Scripts/PlayerController.cs:21)
I’ve tried switching to ASCII but it still failed.
What should I do?