Search Issue Tracker
By Design
Votes
0
Found in [Package]
1.0.0-preview.14
Issue ID
1334063
Regression
No
UXML files does not trigger OnOpenAssetAttribute callback
Reproduction steps:
1. Open attached project "Test_UXMLOnOpen.zip"
2. In Project window, open (double-click) any UXML file located in UI Builder folder's subfolders
3. Open the same file again
Expected result: The OnOpenAssetAttribute is triggered both times
Actual result: The OnOpenAssetAttribute is only triggered after the second time
Reproducible with: 1.0.0-preview.14 (2019.4.25f1, 2020.3.8f1, 2021.1.6f1)
Could not test with: 2018.4.34f1 (UI Builder package unavailable), 2021.2.0a16 (UI Builder errors)
Note:
In 2021.1.6f1, the callback isn't triggered despite the UXML file already having been opened
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
- Skinned Mesh Renderer with multiple Animator Components does not render when "Optimize Game Objects" is enabled
- [iOS]Certain characters are not displayed when using iOS devices with 18 OS and newer
- Trees do not render in 'Unity Terrain - URP Demo Scene'
- Silent crash when clicking in Scene View in a specific project
- The Player renders black on a Quest headset when MSAA, Post Processing, and Spacewarm depth submission are enabled
Resolution Note:
The OnOpenAsset callback is not called because the UI Builder defines a callback with callbackOrder 0 to be able to open UXML files. The callback is consumed here and it will not call the callbacks with a higher callbackOrder. We do not intend to modify this behavior since we want the UI Builder to have the highest priority for those files.
However, it is possible to define a OnOpenAsset callback using a negative callbackOrder index. This allows users to define their own callbacks without interfering with the callbacks already defined by Unity (like the UI Builder callback). The documentation states you can use only positive numbers for this index but in reality you can use negative numbers too. The documentation will be updated shortly.