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
- [Linux] Assertion failed on expression 'success && actual == size' error is thrown when building project to another partition with a different file system
- Import Activity window shows "(None)" in the Asset field when changing the path of the asset
- Material setting changes when saving the Scene
- Sprite Mask's Alpha Cutoff value dragging is too sensitive
- Hover style remains on elements after the cursor is moved away when the 'transition-delay' property is used
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.