I have just stared down the wonderful road of InvokeRepeating methods. What I would like to know is; is there a easy way to toggle these methods on and off. For example lets say I have a class with
and I want the component to spawn new characters only when its not adding resources, and vice versa. I had thought about making one method that will spawn either or based on a toggle, but I know I will be extending this class and adding other possible actions.
asked Apr 29 '11 at 12:03 AM
You can use CancelInvoke where necessary, but it sounds like coroutines would be more appropriate for this than InvokeRepeating.
In this case, setting "addingResource" to true or false toggles between the two functions.
answered Apr 29 '11 at 12:54 AM
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.CancelInvoke.html Seems like you could do that easy enough
answered Apr 29 '11 at 12:46 AM