invokerepeating unity code example
Example 1: unity invokerepeating
void Start()
{
//function name, start in, every (x) seconds
InvokeRepeating("LaunchProjectile", 2.0f, 0.3f);
}
void LaunchProjectile()
{
Rigidbody instance = Instantiate(projectile);
}
Example 2: unity cancel invokerepeating
CancelInvoke();