Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PingObject

Ping an object in the Scene like clicking it in an inspector.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

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.
Warning
Removed. PingObject(int) is obsolete. Use PingObject(EntityId) instead.
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); }}

PingObject(EntityId)

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

Parameters

targetEntityId

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); }}