Whats wrong in my button on click event ???
I have made a button and I have assigned a function to "On Click" button event, this is the function & its variables :
var IsNitroPressed : boolean ;
var NitroStart : int ;
var FireRight : Transform ;
var FireLeft : Transform ;
function NitroEnable () {
IsNitroPressed = true ;
NitroStart = Time.time ;
FireRight.gameObject.setActive(true);
FireLeft.gameObject.setActive(true);
ShipMove2.MaxSpeed = 60 ;
ShipMove2.SpeedBooster = 3 ;
}
Now,the problem is :
When I play the game and press the button only the last two commands in the function are being applied(Commands which contain ShipMove2 "ShipMove2 is another script that Iam calling variables form it"),and the other commands are not being applied while the game is running,But when I stopped the game they were applied , for example the variable "IsNitroPressed" was staying false until I have stopped the game, it became true!!!
And the variable "NtroStart" isn't have any value until I stop the game, its take the correct value that it should take!!
And the two variables "FireRight"&"FireLeft", they still disabled until I stop the game, they become active.
Any suggestions for what is going on with my button ????!
Your answer
Follow this Question
Related Questions
Argument Exception when no arguments? Method Arguments are Incompatible 0 Answers
How to handle multiple button on addListener 3 Answers
Why can't spam click on UI Image ? 0 Answers
Detecting a button click 1 Answer
Assign UI-Button position to Object? 0 Answers