Fast Invoke
Do you want more performant and more flexible Invokes? Fast Invoke can do all of that! Use it to invoke methods with many different delays and repeats with minimum performance costs!
by Dev Dunk Studio
★★★★ star rating
Price History +
Fast Invoke is an alternative to the MonoBehavior Invoke and InvokeRepeating.
Fast Invoke uses Tasks, to run your code asyncronously. This will be great for performance as well as make your code more flexible and modular!
Performance
MonoBehavior Invoke uses reflection (using the input string to search through all methods and select the right one) to call the desired method. This is very slow. Fast Invoke uses Actions as an alternative, which is a lot faster!
Even Better
Next to performance benefits, Fast Invoke also allows you to add any variable to the function being called (using generics). This way you can pass any variable you desire, so you don't have to rely on global variables for the variables used in the invoked method.
More Functionality
MonoBehavior Invoke just has Invoke and InvokeRepeating, which Fast Invoke also has (but improved). Next to this Fast Invoke also has InvokeMultiple and InvokeMultipleRepeated, so you can run the desired method multiple times from 1 line of code!
A great example use case would be spawning waves of enemies on a timer, which can easily be managed this way.