Search Issue Tracker
By Design
Votes
8
Found in
2021.3.9f1
2022.1.15f1
2022.2.0b7
2023.1.0a9
2023.2.0a1
2023.3.0a3
Issue ID
UUM-13181
Regression
No
VisualElement.TrackPropertyValue doesn't invoke the callback when the property is under SerializeReference and SerializeField attributes
How to reproduce:
1. Open the user’s attached “Repro-UxCallback” project
2. Select “test asset” asset in the Project Browser
3. Change the value of “My Interface → Name” field in the Inspector
Expected result: Two messages are printed in the log
Actual result: Only the “SerializedObject tracking” message is logged, and not the “SerializedProperty tracking”
Reproducible with: 2021.3.9f1, 2022.1.15f1, 2022.2.0b7, 2023.1.0a9
Couldn’t test with: 2020.3.39f1 (TrackPropertyValue method isn’t featured)
Reproduced on: macOS 12.5 (Intel)
Comments (2)
-
tylertempdev
Nov 22, 2024 17:12
This is fine. But if you combine it with another issue: https://issuetracker.unity3d.com/issues/visualelements-that-use-trackpropertyvalue-keep-tracking-properties-when-they-are-removed then it's a disaster...
-
VincentPaquin
Oct 11, 2023 14:15
Reproduced on Windows 11
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Dragging and dropping a system that contains event context to create nested VFX crashes the editor
- TextMeshPro UV2 custom data not rendering for off-screen text with RectMask2D in Unity 6
- Text overlap and is unreadable in Inspector > Terrain Paint Texture after creating new Terrain Layer
- Event "XRInputSubsystem.trackingOriginUpdated" triggers twice when recentering the view
- UITK TextField value is overwritten incorrectly by the converter result when Binding Mode is set to "To Source"
Resolution Note:
The repro project uses TrackPropertyValue for "myInts.myInterface", which is the reference itself. That reference's value doesn't change: it refers to the same StringAAA instance throughout. What changes is the "myInts.myInterface.name " property, which, if used in TrackPropertyValue, triggers the callback as expected.
If the user doesn't want to be explicit about tracking inner properties of serialized references, they can also use a custom PropertyDrawer for their specific implementations of the interface, in this case StringAAA, and track the property changes that correspond to their specific fields in the PropertyDrawer's implementation, where the complexity is properly encapsulated.
Tracking changes in the contents of the SerializedRerefence is not supported and is not what this feature was intended for.