Drawing Gizmos

You can use flow graphs to draw gizmos with the On Draw Gizmos and  On Draw Gizmos Selected events. Gizmos are visual helpers that are drawn over game objects while in the editor. They can be useful to show information about range, bounds, etc. for your custom behaviours.

All the functions used for gizmos are found under the Gizmos class in Codebase > Unity Engine. A common first step is to make their matrix match the one of the current object (meaning the gizmos will be positioned in "local space"), then assign a color. For example, the following graph draws a wire cube gizmo around the object:

As you can see, this code gets executed while in edit mode. It's important to note that not all Bolt features will be available, most importantly nested graphs.

Be extremely careful when drawing gizmos. Even though you can use any method from the codebase, you should probably limit yourself to methods in the Gizmos class. Otherwise, you can easily create a graph that crashes the editor or corrupts data.

This article was helpful for 7 people. Is this article helpful for you?


Gizmo Get Matrix stays Red with error

MissingValuePortInputException: Missing input value for 'input'.

Bolt.ValueInput.GetValue (Ludiq.Recursion recursion) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Ports/ValueInput.cs:81)
Bolt.ValueInput.GetValue () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Ports/ValueInput.cs:89)
Bolt.ValueInput.GetConvertedValue () (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Ports/ValueInput.cs:95)
Bolt.SetMember.Assign (Bolt.Flow flow) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Framework/Codebase/SetMember.cs:99)
Bolt.ControlInput.Trigger (Bolt.Flow flow) (at C:/Users/Lazlo/Projects/Ludiq/Bolt.Flow/Runtime/Flow/Ports/ControlInput.cs:78)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)