Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PingObject

Ping an object in the Scene like clicking it in an inspector.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

PingObject(Object)

Ping an object in the Scene like clicking it in an inspector.
public static void PingObject(Object obj)

Parameters

The object to be pinged.

Remarks

EditorGUIUtility.PingObject will cause the Hierarchy to highlight the pinged object. The pinged object does not have to be selected. For example GameObject.Find can be used to locate an object to ping.

Examples

// Pings the currently selected Objectusing UnityEditor;using UnityEngine;public class PingObjectExample{ [MenuItem("Examples/Ping Selected")] static void Ping() { if (!Selection.activeObject) { Debug.Log("Select an object to ping"); return; } EditorGUIUtility.PingObject(Selection.activeObject); }}

PingObject(int)

Ping an object in the Scene like clicking it in an inspector.
public static void PingObject(int targetInstanceID)

Parameters

targetInstanceID

Remarks

EditorGUIUtility.PingObject will cause the Hierarchy to highlight the pinged object. The pinged object does not have to be selected. For example GameObject.Find can be used to locate an object to ping.

Examples

// Pings the currently selected Objectusing UnityEditor;using UnityEngine;public class PingObjectExample{ [MenuItem("Examples/Ping Selected")] static void Ping() { if (!Selection.activeObject) { Debug.Log("Select an object to ping"); return; } EditorGUIUtility.PingObject(Selection.activeObject); }}