How to show the Debug.Log text Ingame

Hello Ladys and Gentlemen!

Thanks for looking at my question! So I created a PHP file which successfully registers new users with the help of the UnityWebRequest, but i want to get the Debug.Log from the downloadHandler into my Game. So it tells me which errors I made, for example Username already exists / Creating User… / Registered User successful. So i tried to just create a common public GameObject, and give it the text from the downloadHandler. So it looked something like that:
NameOfGameObject.GetComponent().text = Debug.Log(www.downloadHandler.text);:wink:
And I know by myself after i tried that it’s pretty dumb because i obviously can’t convert a void into a string but how can i get the echo from the console into my Game? The PHP file works fine and gives me the correct Errors and shows them right in the console but Iam stumped how I can show it in my Game.

Thanks for reading my Question, have a wonderful day
Yours
Puiki

Why can’t you just remove Debug.Log and make it look something like:

string someTextFromNet = ...
NameOfGameObject.GetComponent<Text>().text = someTextFromNet;

Just grab the string of error from net if you know how and put it into the text property of Text component.

1 Like

Thank you so much!
Iam pretty new to programming so I didn’t think about that, quite dumb if I think about it haha.
Have a pleasured day!

1 Like

Just so you know, stuff you write to the console using Debug.Log/Warning/Error shows up in the log file when called in a build.
You can find the log files in that %appdata% system file thing(or something like it, i can’t recall - also depends on the OS) under your unity account name.

1 Like