Hi guys, I’m new to coding unity.
Can I change scene in random.range (1, 30) but with specific probability like 20% for 1-10, 20% for 11-20, and 60% for 21-30 ?
I’m glad if you want to explain with script
thanks
Hi guys, I’m new to coding unity.
Can I change scene in random.range (1, 30) but with specific probability like 20% for 1-10, 20% for 11-20, and 60% for 21-30 ?
I’m glad if you want to explain with script
thanks
var r = Random.Range(0, 100);
if (r < 20 ) {
scene = Random.Range(1, 10);
}
else if (r >= 20 && r < 40) {
scene = Random.Range(11, 20);
}
else if (r >= 40) {
scene = Random.Range(21, 30);
}