- Home /
server side highscores tutorial: text on gameobject question
Hi there, I'm very new to unity and I've hit a little bit of a bump when following this tutorial. I have also posted the relevant text below, although without being too specific I think what I need to do is display text on a gameobject. What is the easiest way of doing this? How can I easily link the variable in any given script with a gameobject so that it will display on the screen when I run a program?
Thank you in advance.
(also bonus points if you can explain what he means by 'include' the md5 hash. How do I do that? put the script in a separate file and link them together.. how? thanks again!
Step 3: The Unity HSController Script
You will attach this script to a GameObject. You need to be able to supply it with a string containing the players name, and a
string containing the players score. You also need to edit the URLs in it that point to the correct addscore.php script and the
display.php. You will also need to supply it with a GUIText if you want it to get the scores (otherwise you can ignore the
getScores() function).
You will also need to include the MD5 script previously posted to this Wiki in your project folder.
Answer by AVividLight · Apr 15, 2012 at 11:21 PM
Hey SirYakalot,
If I were you, I would use a GuiText variable, and then reference it in the script using something like this:
YourGUIText = highscore;
where highscore is the string that is supplied by the tutorial's script, and YourGUIText is a GuiText variable declared at the top of the script. If I didn't do a good job explaining this, please let me know so I can give you a better example
-Gibson
-Edit-
The variable GuiText must be assigned to a GUIText GameObject [From GameObject>CreateOther>GUIText]
This is helpful, thank you. Would you $$anonymous$$d just explaining the basics though? Is there a GUI text game object I drag into the scene? How do I then attach the variable? Are all scripts aware of all objects variables?
(really sorry for the newbie question!)