Window Framework for UI Toolkit v2.0.x
GWG.Extensions.TexturePreviewElement Class Reference

Editor-only bindable Texture2D picker with an image preview. More...

Inheritance diagram for GWG.Extensions.TexturePreviewElement:
Collaboration diagram for GWG.Extensions.TexturePreviewElement:

Public Member Functions

 TexturePreviewElement ()
 Builds an editor object picker and preview using the packaged resource stylesheet.
void SetValueWithoutNotify (Object newValue)
 Updates picker and preview without emitting this control's value-change event.

Static Public Attributes

static readonly string ussClassName = "texture-preview-element"
 Root class used by the supplied editor preview stylesheet.

Properties

Object value [get, set]
 Gets selected borrowed texture; assignment validates and sends ChangeEvent when changed.

Private Member Functions

void OnObjectFieldValueChanged (ChangeEvent< Object > evt)

Private Attributes

ObjectField m_ObjectField
Image m_Preview
Texture2D m_Value

Detailed Description

Editor-only bindable Texture2D picker with an image preview.

Uses UnityEditor.UIElements.ObjectField and the texture_preview_element editor resource sheet. This is not a runtime player-image importer or a VectorImage picker. Selected project textures are borrowed and never destroyed by this control. Bind the value property or subscribe to ChangeEvent<UnityEngine.Object> in its owning inspector.

Constructor & Destructor Documentation

◆ TexturePreviewElement()

GWG.Extensions.TexturePreviewElement.TexturePreviewElement ( )
inline

Builds an editor object picker and preview using the packaged resource stylesheet.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ OnObjectFieldValueChanged()

void GWG.Extensions.TexturePreviewElement.OnObjectFieldValueChanged ( ChangeEvent< Object > evt)
inlineprivate
Here is the caller graph for this function:

◆ SetValueWithoutNotify()

void GWG.Extensions.TexturePreviewElement.SetValueWithoutNotify ( Object newValue)
inline

Updates picker and preview without emitting this control's value-change event.

Parameters
newValueBorrowed Texture2D reference or null to clear.
Exceptions
ArgumentExceptionA nonnull value is not Texture2D.

Field Documentation

◆ m_ObjectField

ObjectField GWG.Extensions.TexturePreviewElement.m_ObjectField
private

◆ m_Preview

Image GWG.Extensions.TexturePreviewElement.m_Preview
private

◆ m_Value

Texture2D GWG.Extensions.TexturePreviewElement.m_Value
private

◆ ussClassName

readonly string GWG.Extensions.TexturePreviewElement.ussClassName = "texture-preview-element"
static

Root class used by the supplied editor preview stylesheet.

Property Documentation

◆ value

Object GWG.Extensions.TexturePreviewElement.value
getset

Gets selected borrowed texture; assignment validates and sends ChangeEvent when changed.

Same-value assignment is inert. Does not save a ScriptableObject or acquire/release imported textures. Use SetValueWithoutNotify for inspector synchronization to avoid feedback.