Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RegisterCustomHandler(string, Action<string, EntityId[]>, Func<string, EditorWindow, bool>)

Registers a handler for custom non-Object based selection in selection history.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public static void RegisterCustomHandler(string key, Action<string, EntityId[]> handler, Func<string, EditorWindow, bool> validator = null)

Parameters

A unique string that identifies the selection handler.

A function that handles custom non-Object based selection in selection history.

A function that validates custom non-Object based selection in selection history. Use the Validator to confirm that the given selection represented by
customData
is still valid within the given window (optional).

Remarks

The Editor's selection history normally tracks only regular Object-based selection. If you have an Editor window or an Editor tool that has a custom "selection" concept and you want that to participate in the selection history, use Selection.RegisterCustomHandler and Selection.SetCustomSelection. Unity calls this handler when a user navigates back to a selection entry that was recorded with Selection.SetCustomSelection. The handler decodes the custom selection data from
customData
string, and can optionally use the passed
selectedObjects
EntityIDs. Additional Resources: Selection.RegisterCustomHandler, Selection.SetCustomSelection.