NOTE:
- I am just cracking open Unity and am working in a Win7 environment w/ Unity 5.4.3f1 and Mono 5.9.6
- also, it looks like my code formatting got lost in the post - is there a proper way to post scripts?
I have a group of four objects that I am changing focus on by using the arrow keys.
e.g.: R-arrow cycles from obj0 > obj1 > obj2> obj3 > obj1 … and so on. L-arrow does the same in reverse.
void GetObjLeft() {
if (selectedObjPositon == 0) {
selectedObjPositon = 3;
SelectObj (Obj [3]);
} else {
selectedObjPositon – ;
SelectObj (Obj [selectedObjPositon]);
}
}
void GetObjRight() {
if (selectedObjPositon == 3) {
selectedObjPositon = 0;
SelectObj (Obj [0]);
} else {
selectedObjPositon ++ ;
SelectObj (Obj [selectedObjPositon]);
}
}
Once one of the objects has met a certain criteria [moving more than 4 on the z aixs] I want it to be removed from the loop so I don’t need to hit the arrow keys multiple times to skip over the missing asset. I thought I could just reassign it’s selectedObjPostion to something outside of the loop (like 50), but that just kills the index.
I got as far as:
if (selectedObj.transform.position.z > 4) {
removeObjFromLoop();
}
but I’m stuck on the function for “removeObjFromLoop”
–thanks in advance for any tips.