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
- Visible instance buffer returns 0 for every instance when using BatchDrawCommandIndirect on Adreno devices with Vulkan API
- [Android][Vulkan] Native crash in AndroidVulkanVideo::ProcessFrame and AndroidVulkanVideo::Context::~Context() when switching screens
- Screen brightness is not set to a default value when Screen.brightness is set to a negative value
- macOS app window title is not localized when built from generated Xcode project
- Unity Hub doesn't preserve the changed Channel when manually restarting the Hub
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.