- Home /
to change "Fire1" to "Fire2" by public variable
Hello I am not a programmer so could someone help me? I have weapon controller script with this line:
if (Input.GetButton("Fire1") && Time.time > nextFire)
What I want is to change "Fire1" to "Fire2" by public variable. Is it possible?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by FlaSh-G · Jun 21, 2017 at 11:33 AM
Sure!
 public string axis = "Fire1";
 void Update()
 {
   if (Input.GetButton(axis) && Time.time > nextFire)
Answer by Mulldor · Jun 21, 2017 at 11:32 AM
If I am not mistaken, you are unable to change the Input keys via scripting.
But if you need to access them publicly (from editor), you can find them under: Edit > Project Settings > Input
Your answer
 
 
             Follow this Question
Related Questions
Animator parameter stays true after mouse button released. 1 Answer
Weapon Selector 1 Answer
Xsi to unity animation problems 0 Answers
need help with [] 1 Answer
FPS - Gun Delay while Rotating 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                