Hi there, can someone help me adapt the code below to send a random number to Playerprefs, say between 1 and 10? Thanks.
PlayerPrefs.SetInt("Player Score", 10);
Hi there, can someone help me adapt the code below to send a random number to Playerprefs, say between 1 and 10? Thanks.
PlayerPrefs.SetInt("Player Score", 10);
Random.Range(0, 11)
Remember that when using Random.Range with integers it will never use the upper bound
I don’t know why you want to do this, but it works like this:
PlayerPrefs.SetInt("Player Score",Random.Range(0,100));
The random value will be between 0 (inclusive) and 100 (exclusive), so 0-99. Of course you can change the values.