Hi,
I’m evaluating migrating an turnbased Android game from Android Studio to Unity. The game calls a REST API on a backend server (Google AppEngine, JSON encoded HTTP requests) so I need to be able to call the backend from within Unity.
As a proof of concept, I am generating a C# client-side API using https://swagger.io/ and testing it against swagger’s “petstore” testserver. The code generated from swagger has a dependency towards two other components (Newtonsoft and Restsharp). I have successfully built the clientside dll from the code generated by swagger and imported the resulting dll plus the Newtonsoft and Restsharp dlls into Unity. I had to change the Scripting Runtime Version in Unity to “Experimental (.NET 4.6 Equivalent)” in order to be compatible with the C# client side API I built.
When building for Windows platform everything seems to work when I run the application. I can call the petstore REST API. But on Android, I get a very uninformative runtime error (“error calling xxxxx: getdomainname”).
A few questions:
- Should it be possible at all to deploy on Android even though I have imported external dll’s as described above? I’m not very familiar with the .NET runtime environment and dll concepts.
- Has anyone generated client side API’s for REST backend API with some other tools? I really need a client side wrapper since my client-server communication uses rather complex data structures and I do not want to manually encode/decode the JSON data.