Question by
Gavbean · Apr 11, 2017 at 05:13 PM ·
if statement
Issues with if staements (Again) :/
i don't know why this doesn't work :/ when i run the script i get this error :
UnityEngine.Random.Range (Int32 min, Int32 max) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/RandomBindings.gen.cs:57)
here is the script :
function Roam() {
chance = Random.Range(0, 100);
if(chance >= 0 && chance <= 25 && last != 1) {
Debug.Log("1");
last = 1;
} else {
Roam();
}
if(chance >= 26 && chance <= 50 && last != 2) {
Debug.Log("2");
last = 2;
} else {
Roam();
}
if(chance >= 51 && chance <= 75 && last != 3) {
Debug.Log("3");
last = 3;
} else {
Roam();
}
if(chance >= 76 && chance <= 100 && last != 4) {
Debug.Log("4");
last = 4;
} else {
Roam();
}
}
Comment
i ended up fixing this one too so dont feel the need to respond :D
Your answer
