|
Ok, i have this script:
This mean that when i pres the button it add 10 Wood. But is there posible to add 10 wood until I tell it to stop? (I want also to remain the button)
(comments are locked)
|
|
Perhaps something along the lines of: Ah, good thinking, he wouldn't want to produce wood every frame. You can combine this with the Toggle button by moving the stuff from Update() to OnGui: function OnGUI() { if(GUI.Toggle(Rect(90,10,150,40),false,"Work")) { [same as above] } else { if(addingwood){CancelInvoke("addWood"); addingWood = false;}}}
Aug 07 '10 at 12:16 AM
Wolfram
Yes thats true but it is likely that some other factor in his game stops the production of wood rather than the button I suspect.
Aug 07 '10 at 12:32 AM
cncguy
(comments are locked)
|
|
If you want something to happen repeatedly while the user holds down that button, use GUI.RepeatButton(). If you are looking for a toggle button (click once -> button stays enabled and wood is produced. click again -> button gets disabled), use GUI.Toggle().
(comments are locked)
|
|
thanks a lot! it is very helpfull
(comments are locked)
|
