Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

EditorGUIUtility.PingObject

static function PingObject(obj: Object): void;
static void PingObject(Object obj);
static def PingObject(obj as Object) as void
static function PingObject(targetInstanceID: int): void;
static void PingObject(int targetInstanceID);
static def PingObject(targetInstanceID as int) as void

Description

Ping an object in a window like clicking it in an inspector.

	// Pings the currently selected Object
	
	@MenuItem("Examples/Ping Selected")
	static function Ping() {
		if(!Selection.activeObject) {
			Debug.LogError("Select an object to ping");
			return;
		}
		EditorGUIUtility.PingObject(Selection.activeObject);
	}