how could I make a bool true and make other bools false?
I wrote a code but it's a little large and not working fine , I just wanted to know is there a better way or not.
 public bool a1;
 public bool a2;
 public bool a3;
 void Update(){
 if(a1   ){
 a2=false;
 a3=false;
 }
    if(a2   ){
    a1=false;
    a3=false;
    }
   if(a3   ){
    a1=false;
    a2=false;
    }
 }
 
also when a1 is true I can't make other bools true.please help xD.
Answer by Cuttlas-U · Sep 27, 2017 at 01:53 PM
hi; always put "Else" for your "if" statements otherwise each "if" will work in update method;
  void Update(){
  if(a1   ){
  a2=false;
  a3=false;
  }
   else  if(a2   ){
     a1=false;
     a3=false;
     }
   else if(a3   ){
     a1=false;
     a2=false;
     }
  }
if u want to find a better way to wirte it i need to know what u want to do exactly;
hi, still not working
look , I want to create some bools and access to them form another script, and when I set a bool true , others should get false.
for example if I set a2 true via some script it should make a1 and a3 false and a2 true.
@Cuttlas-U please download and watch this video.it's only 2$$anonymous$$B,then you might get what I want.
https://expirebox.com/download/a07db1794ac7041d6de4c70b0cb2d537.html
Your answer
 
 
             Follow this Question
Related Questions
What Does GetComponents mean & What does it do?! 2 Answers
What Does It Mean By GetComponent & How do you Use It?! 1 Answer
Word guessing game 1 Answer
Raycast shotgun help! 2 Answers
How can I separate my Code efficiently ? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                