IGEditorUtils.

OnSceneGUI(Action, bool) Method

Summary

Registers the specified method to be called while drawing the UnityEditor.SceneView GUI.

Syntax

public static Action OnSceneGUI(Action doGUI, bool log = false)

Examples

You can prevent the delegate from being garbage collected by storing it as you pass it into this method.

#if UNITY_EDITOR
    private Action _OnSceneGUI;

    public ThisClassName()// Constructor.
    {
        InspectorGadgets.Editor.IGEditorUtils.OnSceneGUI(_OnSceneGUI = () =>
        {
            UnityEditor.Handles.CubeHandleCap(0, default, Quaternion.identity, 1, Event.current.type);
        });
    }
#endif

Remarks

This allows you to use the UnityEditor.Handles class which isn't available during a UnityEngine.MonoBehaviour OnDrawGizmos message.

If the System.Delegate.Target is an UnityEngine.Object, the method will be de-registered when that object is destroyed.

Otherwise it will be de-registered when the delegate itself is garbage collected.

Parameters

Name Type Description
doGUI Action
log bool

Return Value

Type Description
Action