There is no such thing as “a void” in C#. There are methods.
InvokeRepeating continues to invoke the method perpetuity until StopInvoke is called or the GameObject is destroyed or deactivated. It is not possible to change the contents of a method at runtime, so I’m not sure what you mean by:
If you’re saying there’s an if (condition) in the method, then that condition will run and be evaluated whenever the method runs, naturally.
Ok I understand better, thank you, I haven’t slept much lately, and my cognitive faculties are weak ^^
PraetorBleu
Yes null is not appropriate, but I understood what you said.
Better then that I use:
CancelInvoke();
This will optimize rather than just a bool, that was the point of my question.
I’m learning little by little like everyone else ^^ The world of unity is vast, it’s going to take me a little time before assimilating the essentials ^^
Thank you very much I learned a new trick, even if it was logical, and I could have done the deduction on my own, tonight I have a little trouble ^^
My sole reason for recommending a coroutine is that you can stop it. You seemed to want to have a way to stop the InvokeRepeating in your original post.
Oh okay thank you.
My question was very badly posed, because I don’t understand something, now it’s clearer.
So for the coroutine I still don’t understand, but I guess to tell you that it uses resources, up to its stop.
So, I found for the invokes:
CancelInvoke() and CancelInvoke(methodName: string)