Перейти к основному содержимому

Class VisualElementExtensions

Namespace: Aspid.FastTools.UIElements.Editors
Assembly: Aspid.FastTools.Editor.dll

Provides extension methods for VisualElement.

public static class VisualElementExtensions

Inheritance​

object ← VisualElementExtensions

Methods​

AddOpenScriptCommand<T>(T, Object)​

Registers a double-click handler that opens obj's script in the IDE.

public static T AddOpenScriptCommand<T>(this T element, Object obj) where T : VisualElement

Parameters​

element T

The element to register the command on.

obj Object

The object whose script is opened.

Returns​

T

element for chaining.

Type Parameters​

T

A VisualElement element to configure.

Remarks​

Supports MonoBehaviour and ScriptableObject; a resolved script is required, so it has no effect otherwise.

BindTo<T>(T, SerializedObject)​

Binds the element to obj.

public static T BindTo<T>(this T element, SerializedObject obj) where T : VisualElement

Parameters​

element T

The element to bind.

obj SerializedObject

The serialized object to bind to.

Returns​

T

element for chaining.

Type Parameters​

T

A VisualElement element to configure.

GetOwnerWindow(VisualElement)​

Returns the window hosting element or the current focus or hover fallback.

public static EditorWindow GetOwnerWindow(this VisualElement element)

Parameters​

element VisualElement

The element to locate, or null to use the fallback windows.

Returns​

EditorWindow

The hosting window, then the focused or hovered window; otherwise, null.

Remarks​

A pointer event can arrive in a floating window before focus moves, so the panel is checked first.

UnbindFrom<T>(T)​

Unbinds the element from its serialized object.

public static T UnbindFrom<T>(this T element) where T : VisualElement

Parameters​

element T

The element to unbind.

Returns​

T

element for chaining.

Type Parameters​

T

A VisualElement element to configure.