Unity: Add UI Toolkit support for SerializableReactiveProperty inspector drawer#370
Open
murnana wants to merge 1 commit intoCysharp:mainfrom
Open
Unity: Add UI Toolkit support for SerializableReactiveProperty inspector drawer#370murnana wants to merge 1 commit intoCysharp:mainfrom
murnana wants to merge 1 commit intoCysharp:mainfrom
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
CreatePropertyGUIoverride toSerializableReactivePropertyDrawerfor Unity UI Toolkit (UIElements) support.Changes
CreatePropertyGUIoverride usingPropertyFieldandTrackPropertyValueto support UI Toolkit-based inspectorsForceNotifylogic fromOnGUIinto a shared private method, reused by both IMGUI and UI Toolkit code paths#if UNITY_2022_3_OR_NEWERsincePropertyDrawer.CreatePropertyGUIwas introduced in Unity 2022.2+Why
Unity 2022.3+ uses UI Toolkit for the default Inspector. Without
CreatePropertyGUI,SerializableReactiveProperty<T>falls back to the IMGUIOnGUIrendering, which can cause layout issues when mixed with UI Toolkit-based custom editors or when using[CreateProperty]-based bindings.Notes
TrackPropertyValueis used to detect value changes and callForceNotify, ensuring reactive subscribers are notified — consistent with the existing IMGUI behavior added in Call ForceNotify on SerializedReactiveProperty edtiro inspector change on Unity #140OnGUIandGetPropertyHeightremain unchanged