-2

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.

RCDJ
  • 1
  • 1
  • Please include your code, point out what exactly your goal is, what exactly you tried and what exactly doesn't work ... if you already got your data vis the `UnityWebRequest` then what exactly is your question? – derHugo Aug 31 '20 at 06:02
  • Hi, I got my data to appear in the unity console, is there a way to print this and save it as file in the project? If i managed to do that, then i could search through it for the variable I need. I have tried so much code that I dont know which one to put in the question. – RCDJ Aug 31 '20 at 12:40
  • Still, your question is a bit strange. You say your `UnityWebRequest` is already working as expected and returning the result. You even print it to the console. So your question is basically: [**How do I write data to a file in c#?**](https://stackoverflow.com/questions/7569904/easiest-way-to-read-from-and-write-to-files) ... the parsing for a certain value depends completely on your data structure (e.g. JSON, XML, YAML, CSV, simple config style like `name = value`, etc) but why would your write the result to a file before parsing it .. you can already work with the string you have ... – derHugo Sep 02 '20 at 08:10

1 Answers1

-1

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.

Mario
  • 601
  • 3
  • 7