- Home /
How to Draw Gizmos without using a MonoBehaviour?
So I am working on a tool to help give more information about certain parts of the game, and I am trying to Draw Gizmos while in the editor and without any scripts inheriting from MonoBehaviour.
I have searched online for a couple hours now and haven't found anything that works. I have looked into the OnDrawGizmos, DrawGizmo, and Graphics fuctions. Any ideas?
Thanks in advance!
Answer by tanoshimi · Oct 11, 2015 at 03:50 PM
You can't. OnDrawGizmos is the Unity function to draw additional information in the editor scene view, but it will only be invoked on Monobehaviour-derived scripts.
But there's an easy solution - you only need to create one Monobehaviour class that has a reference to your non-Monobehaviour class, and invoke OnDrawGizmos() in that.
Answer by atkins79 · Sep 28, 2018 at 02:13 PM
This sounds like what you are looking for: https://docs.unity3d.com/ScriptReference/DrawGizmo.html