Question by
NinjaRubberBand · Jun 16, 2016 at 01:35 PM ·
2dtogglebox
Make UI yes or no toggle box
In my scene there is two boxes. A yes and a no. I want it so they are always opposites of each other. So when i toggle one, the other one gets toggled off. So there is alway one which is off and one on. How do i achieve this?¨ I use js.
Comment
Answer by Vuzok · Jun 16, 2016 at 01:46 PM
var box1 : boolean =true;
var box2 : boolean = false;
function Update () {
if (Input.GetKeyDown ("space") && box1=true;){
//Replace with you're mouse click on UI box.
box1 = false;
box2 = true;
}
if (Input.GetKeyDown ("space") && box1=false;){
//Replace with you're mouse click on UI box.
box1 = true;
box2 = false;
}
}
Hope thats some help, not sure if you were looking to get the UI part working instead.