Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

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

MonoBehaviour.IsInvoking

Switch to Manual
public function IsInvoking(methodName: string): bool;

Description

Is any invoke on methodName pending?

	// Instantiates a project after 2 seconds when Space key was pressed
	// and it will only call the function after the function has ended its execution

var projectile : Rigidbody;

function Update() { if(Input.GetKeyDown(KeyCode.Space) && !IsInvoking("LaunchProjectile")) Invoke("LaunchProjectile", 2); }

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

Description

Is any invoke pending on this MonoBehaviour?