- Home /
how i execute function after i release button ?
hello , help me plz how i can execute function after i release GUI Button this is my code :
if ( GUI.Button=(Rect (100,200,50,100), "Shoot") ) {
shoot();
}
i want to execute (shoot ) function after i release the GUI button , in javaScript please
Comment
Please don't post duplicate questions. If you don't like answers you received, respond to the answer and explain why it does not work for you. Given your your question, @jamiltron answer seems sound. In particular, GUI.Button() calls execute on the mouse up, not the mouse down. If you mean something else...like have Shoot execute at some specific time after the button is released you can use Invoke:
if ( GUI.Button=(Rect (100,200,50,100), "Shoot") ) {
Invoke("shoot", 0.5);
}
Answer by jamiltron · May 02, 2014 at 05:16 AM
You really should read through the Unity reference on GUI Scripting before you attempt to code a GUI.
Your answer
![](https://koobas.hobune.stream/wayback/20220613144041im_/https://answers.unity.com/themes/thub/images/avi.jpg)