Enhance your unity editor with OnDrawGizmosSelected


Enhance your unity editor with OnDrawGizmosSelected

The video talks about how to display extra information in the unity editor on the selected GameObject.

By drawing lines we can see how some objects are connected, and we take a look at how inspector fields can be visually seen in th editor.
And also how to add extra labels


You can download the the files..
Unity3D package



using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class ShowLink : MonoBehaviour
    public GameObject Link;
    public bool Red = false;

    public void OnDrawGizmosSelected()
        if (Red)
            Gizmos.color = Color.red;
            Gizmos.color = Color.yellow;

        var pos = transform.position + Vector3.up * 2;

        Gizmos.DrawLine(transform.position, pos);

        if (Link == null)
            Handles.Label(pos, $"{name} -> None");

        Handles.Label(pos, $"{name} -> {Link.name}");
        Gizmos.DrawLine(transform.position, Link.transform.position);