简体   繁体   中英

How Can I get data from a local web page and use it in Unity to alter the game?

I am currently using a Rasp pi to show a users average temperature on a local webpage.

Can anyone please try help explain the simplest way to get this into unity, to use it as a variable to alter the game?

For example, if the users temperature is above a certain amount, spawn an enemy?

There is not much information available with regards to UnityWebRequest. I have got as far as connecting to the website and printing it out in the console log, is there a way to save this as a text file in the project and then use it from there? Is there a simpler way to do this?

I have been trying for almost 10 hours and have tried many different tutorials online but none of them are working. I'm sure its something simple but i cannot figure it out. I would really appreciate any help. It's 2 am, I'm a can of Monster and red bull deep. Will float into the sky if someone helps me figure this out.

Hi you can try this way if you dont do it yet. Make and api to get a json with UnityWebRequest so there you can get the json and deserialize to get the value for the temperature.

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