how can I add a second command but to start in the second click?
is not with the first command (Fire1)
function OnGUI()
{
if(GUI.Button(Rect (375,250,100,50), "FIRE"))
messagebroadcast (fire1)
}
Second comand for second click
messagebroadcast (fire2)
how can I add a second command but to start in the second click?
is not with the first command (Fire1)
function OnGUI()
{
if(GUI.Button(Rect (375,250,100,50), "FIRE"))
messagebroadcast (fire1)
}
Second comand for second click
messagebroadcast (fire2)
var labels : Array = ["FIRE1", "FIRE2"];
var events : Array = [fire1, fire2];
var fireId : int = 0;
if(GUI.Button(Rect (375,250,100,50), labels[fireId]))
{
messagebroadcast (events[fireId]);
fireId = 1-fireId;
}
Bit tired, sorry for possible typos or idiocies… :roll:
:shock: :shock: thanks !!! …
can you healp me with this ?
is equal .
Camera.main.fieldOfView = 60;
Camera.main.fieldOfView = 20;
Camera.main.fieldOfView = 10;
Im sorry , but im new in javascript
:shock: :shock: thanks !!! …
can you healp me with this ?
is equal .
Camera.main.fieldOfView = 60;
Camera.main.fieldOfView = 20;
Camera.main.fieldOfView = 10;
Im sorry , but im new in javascript
Hahah, you need to be bit more specific with that question :lol:
If you mean similar toggle button action,… consider that homework (I am going to sleep)
is the same for first-gui … only that broadcast message I did not understand well … and now I need zoom …
if(GUI.Button(Rect (375,250,100,50), “FIRE”))
Camera.main.fieldOfView = 60;
Camera.main.fieldOfView = 20;
Camera.main.fieldOfView = 10;
Something like this, perhaps:
var fieldsOfView = [60.0, 20.0, 10.0];
var currentFoVIndex = 0;
function OnGUI()
{
if(GUI.Button(Rect(375, 250, 100, 50), "FIRE"))
{
// The next line cycles through all the values in fieldsOfView:
currentFoVIndex = ++currentFoVIndex % fieldsOfView.Length;
Camera.main.fieldOfView = fieldsOfView[currentFoVIndex];
}
}
thank you very much i am grateful for the help …
the script is perfect and is how I needed!
I have a question, I searched the documentation but have not found anything,
currentFoVIndex what it do ?
It’s a variable that I defined on the second line of the script. I’m using it to keep track of which entry I’m looking at in the fieldsOfView array.