Gizmos are visual aids that are provided to game designers in the scene panel. In this recipe, we'll highlight the GameObject that is currently selected in the Hierarchy in the Scene panel:
Using Gizmo to show the currently selected object in a scene panel
How to do it...
To create a Gizmo to show the selected object in the Scene panel, follow these steps:
- Create a new 3D project.
- Create a 3D cube by choosing menu: Create | 3D Object | Cube.
- Create a C# script class called GizmoHighlightSelected, and add an instance object as a component to the 3D Cube:
using UnityEngine;
public class GizmoHighlightSelected : MonoBehaviour {
public float radius = 5.0f;
void OnDrawGizmosSelected() {
...