Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Aardvarklord · Feb 17, 2018 at 04:03 PM · client-serverplatform-support

Calling REST Api from within Unity - Android runtime error

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:

  1. 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.

  2. 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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by misher · Mar 08, 2019 at 09:55 AM

I've been working on Unity friendly OpenAPI parser and assets generator https://github.com/kolodi/UnityOpenApi for some time, it resolves all issues with the multi-platform support and leverage many Unity-specific tools to provide an easiest possible way to work with the restful API. It is not finished yet, and I'm working on it now, your contribution is welcomed :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

77 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Does Unity 2.6 Pro support Windows 7 for standalone? 6 Answers

Unity bug when switch the platform android to ios 0 Answers

Which version of .NET is used for UWP builds? 0 Answers

unity database 1 Answer

how to use NetworkServer.SendToClient ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges