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
- Channel remapping dropdown in the Terrain Layer does not open when clicked on the title
- The Editor freezes indefinitely when a large number of elements are entered in the Subgraphs or Categories lists
- Some Visual Effects package Assets links to documentation are not working
- Heatmap asset’s documentation button in the Inspector window leads to “Sorry... that page seems to be missing!” page when clicked
- Crash on MonoBehaviour::CallMethodIfAvailable when performing various actions
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.