In this video we see how to call a function with delay. To do this we use the "Invoke" method defined in the MonoBehaviour class, this method requires two parameters, the first is a string data that contains the exact name of the method to be executed and the second parameter is a float value with the time in seconds that the function will be delayed, then with the following instruction for example:
Invoke("MyFunction",2f);
What we do is to execute the function called "MyFunction" after two seconds. This function has to be defined within the same script, otherwise the call will not be made.
____________________________________________________________
LINKS
Portfolio: https://gamedevtraum.com/en/portfolio...
LinkedIn: / gamedevtraum
Downloads: https://gamedevtraum.itch.io/
Contact 1: contact@gamedevtraum.com
Contact 2: / gamedevtraum
____________________________________________________________
In questa pagina del sito puoi guardare il video online How to DELAY A FUNCTION in Unity (INVOKE method) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato GDT Solutions 16 novembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 4,296 volte e gli è piaciuto 65 spettatori. Buona visione!