Skip to content

Unity: Add UI Toolkit support for SerializableReactiveProperty inspector drawer#370

Open
murnana wants to merge 1 commit intoCysharp:mainfrom
murnana:feature/unity-ui-elements
Open

Unity: Add UI Toolkit support for SerializableReactiveProperty inspector drawer#370
murnana wants to merge 1 commit intoCysharp:mainfrom
murnana:feature/unity-ui-elements

Conversation

@murnana
Copy link

@murnana murnana commented Feb 11, 2026

Add CreatePropertyGUI override to SerializableReactivePropertyDrawer for Unity UI Toolkit (UIElements) support.

Changes

  • Add CreatePropertyGUI override using PropertyField and TrackPropertyValue to support UI Toolkit-based inspectors
  • Extract inline ForceNotify logic from OnGUI into a shared private method, reused by both IMGUI and UI Toolkit code paths
  • Guard with #if UNITY_2022_3_OR_NEWER since PropertyDrawer.CreatePropertyGUI was introduced in Unity 2022.2+

Why

Unity 2022.3+ uses UI Toolkit for the default Inspector. Without CreatePropertyGUI, SerializableReactiveProperty<T> falls back to the IMGUI OnGUI rendering, which can cause layout issues when mixed with UI Toolkit-based custom editors or when using [CreateProperty]-based bindings.

Notes

…perty inspector

Add CreatePropertyGUI override to SerializableReactivePropertyDrawer for
Unity UI Toolkit compatibility. Extract ForceNotify logic into a shared
private method used by both IMGUI (OnGUI) and UI Toolkit code paths,
ensuring reactive subscribers are notified on inspector value changes.
Guarded with UNITY_2022_3_OR_NEWER since CreatePropertyGUI requires
Unity 2022.3+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@murnana murnana changed the title Add UI Toolkit support for SerializableReactiveProperty inspector drawer Unity: Add UI Toolkit support for SerializableReactiveProperty inspector drawer Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant