Answers for "unity random range not repeat"

C#
2

random.range unity not working

//Do u have using System too? If so u have to specify w
UnityEngine.Random.Range(1, 10);
Posted by: Guest on August-04-2020
0

how to never have 2 same values from random function in unity

List<int> usedValues = new List<int>();
 public int UniqueRandomInt(int min, int max)
 {
     int val = Random.Range(min, max);
     while(usedValues.Contains(val))
     {
         val = Random.Range(min, max);
     }
     return val;
 }
Posted by: Guest on July-10-2020
0

unity random range int not working

float rand = UnityEngine.Random.Range(0, 4);              Debug.Log(rand);
Posted by: Guest on March-31-2021

C# Answers by Framework

Browse Popular Code Answers by Language