Random Number every 5 seconds
I am looking for a java script that will pick out a random number between 0 and 360 every 5 seconds. I already have this:
yield WaitForSeconds(2); randomDirection = Random.Range(0, 360);
Thanks for the help!
Never$$anonymous$$d... I don't have time to type an answer and Unity Answers won't let me delete my answer. Sorry.
Answer by Eric5h5 · May 20, 2011 at 07:18 PM
function Start () {
InvokeRepeating ("PickRandomNumber", 5.0, 5.0);
}
function PickRandomNumber () {
// should be obvious from here
Answer by Muzz5 · May 20, 2011 at 07:05 PM
Just add a function Update, with an if statement, calling another function which sets pickNumber to true every 5 seconds.
Your answer
Follow this Question
Related Questions
Hello, Need help with a problem 1 Answer
Wont instantiate game object 1 Answer
How to make function last for X seconds? 1 Answer
Time.deltaTIme does not work the way it should. 1 Answer
Seconds from now to seven o'clock. 1 Answer