Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created December 25, 2015 22:56
Show Gist options
  • Save unitycoder/b8759c19c0129a82ae48 to your computer and use it in GitHub Desktop.
Save unitycoder/b8759c19c0129a82ae48 to your computer and use it in GitHub Desktop.
Custom DrawGizmos for scripts attached to gameobjects in Editor
using UnityEngine;
using UnityEditor;
public class DrawGizmos
{
[DrawGizmo(GizmoType.Active)] // there are also other options for gizmotypes
static void DrawMyGizmo(MyScript script, GizmoType gizmoType) // set MyScript as your script class/name
{
Debug.DrawRay(script.transform.position, script.transform.up*10, Color.red);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment