Search Issue Tracker
By Design
By Design in 2023.3.X
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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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.
Resolution Note (2023.3.X):
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.