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
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
- Files in the target folder are deleted without a proper warning when building an iOS project
- Character animation freezes when toggling animator on/off in a coroutine
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
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.