Random.Range is constantly generating new variables, I need it to generate only 1, help.....

I need a random number for 1 - 6 and I am using public int as the number itself. I use int = Rando.Range(1, 6);
This works in generating random numbers from 1 - 6, what it does wrong is that it will keep generating random numbers even after the first one. I need it to generate one number, that is all. Instead Random.Range will generate one number after the other. It will switch the number so fast that it is barely visible, and my game goes nuts as every variable of the int brings a different game function. I need Random.Range to generate 1 number and then stop, instead of constantly generating one number after the other.

1 Answer

1

Don’t put Random.Range() in Update(), put it in separate function and call it when you need it. You can put it in Start() if you need generate your number once

I did put it in start, basically what I need is for the the to generate 1 number, wait a few then repeat, I have it in start and referr the function back to start(); to loop it, yet it does noy work