Hi I’m new to Unity, I’m having a problem with writing a line of code. I need to write If x amount of seconds have passed, move GUItext to the bottom right corner. A little stuck on how I should go about writing it. Any ideas or help of what I should do would be much appreciated.
This is very easy so you will catch up quick
Lucky for GUI coding is that OnGUI() supports coroutines (timing)
so you could for instance write
//This will be telling the button's position
var Position:Vector2(ScreenWidth,ScreenHeight);
function OnGUI(){
If(GUI.Button ("name")Position){
your function or anything;
}
yield WaitForSeconds (Amount of seconds goes here);
//and when the time has passed here we will change the coördinates of the Position variable
Position = Vector2(ScreenWidth,ScreenHeight);
}
Now this script is probably not correct because I just made it here on the fly, but it does follow the same principle you must handle to do what you are anticipating.