简体   繁体   中英

Unity3D webpage connection

I started to work on project in Unity but I got stuck on a web connection.

Can I use inside unity to messages spitted out from a Website as Log(message)? Website is on JS with some JS libs

I want to use them as variable/inputs for my project.

Can I use them? How?

Sure you can. Unity documentation has a quite nice code sample about retrieving from the web: https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Get.html

You can execute the code on regular basis, polling the web URI for messages. In case your website exposes an API to pick the messages from a queue is even better. In such a case, there is a great free asset that makes it really easy to do: https://assetstore.unity.com/packages/tools.network/rest-client-for-unity-102501

I hope this helps;)

~Pino

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM