Hello! I want to instantiate obj A , B , C randomly. However, I want to set that the percentage that instantiate obj A is higher than B n C. For ex: A = 70 %, B =20 %, C = 10. So how can I achieve that? Thanks in advance!
How about
whateverType[] thingiesArray = new whateverType[]{A, A, A, A, A, A, A, B, B ,C};
That way, there’s a higher chance of certain elements being picked.
Or, you could have a weighted random value like this-
float value = Random.value;
if(value > 0.9f)
{
C;
} else if(value > 0.7f){
B;
} else {
A;
}
There are probably more ways… Additional answers are welcome!