Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

MonoBehaviour.Invoke

public method Invoke(methodName: string, time: float): void;

Description

Invokes the method methodName in time seconds.

// Launches a projectile in 2 seconds

var projectile : Rigidbody;

Invoke("LaunchProjectile", 2);

function LaunchProjectile () { var instance : Rigidbody = Instantiate(projectile); instance.velocity = Random.insideUnitSphere * 5; }

Did you find this page useful? Please give it a rating: