- Home /
show "labelnew" after clicking a button and hide "labelold"
hi there ive created a several guilabels on screen. I also created two buttons "bigger" and "smaller" . the gui labels are all different sizes and need to start with one size and depending on the user clicking bigger or smaller it needs to show the correct gui label.(bigger or smaller than currently on screen)
I have some experience with actionscript3 using flash and I would use the onmouseclick label.visible = true for the label i wanted to show and visible = false for the labels that need to be hidden.
Could anyone assist me on how to code this in javascript and in unity please?
Answer by Grcan SERBEST · Feb 24, 2011 at 11:56 PM
Hello Raz,
if you connect your labels to a contingent. The connected labels will work when situation occur.
Example ;
function OnGUI () {
if (GUI.RepeatButton(Rect(10,10,50,50),"try")){
GUI.Label (Rect (100, 100, 100, 20), "new");
}
else{
GUI.Label (Rect (100, 100, 100, 20), "old");
}
}
Regards
Grcan
Your answer
Follow this Question
Related Questions
hide button 1 Answer
Hide GUI Text when button is pressed 1 Answer
Text is too small while displaying in device 1 Answer
How do I hide object in scene editor? 3 Answers