Search Issue Tracker
By Design
Votes
0
Found in [Package]
1.0.0-preview.14
Issue ID
1350951
Regression
No
[UI Toolkit] Visual Element flashes for a single frame when doing USS animations
How to reproduce:
1. Open the attached project's Scene labeled "SampleScene"
2. Enter the Play Mode
3. Observe the Game View
Expected result: Red square is not shown
Actual result: Red square flashes for a single frame
Reproducible with: 1.0.0-preview.14 (2021.1.15f1) (Square doesn't disappear instead), 2021.2.0b7, 2022.1.0a5
Not reproducible with: 1.0.0-preview.14 (2020.3.16f1)
Couldn't test with 2019.4.29f1 (UI Toolkit is not available), 2021.1.16f1, 2021.1.17f1 (unresolvable UI Toolkit errors)
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
- The "UnityWebRequest.result" of the "UnityWebRequestTexture.GetTexture" method changes when accessing "UnityWebRequest.downloadHandler" texture
- Slider rounding does not allow setting certain valid numbers as Values when Low and High Values not set to default
- UI Builder Canvas has too big resizing zone on the outside of the canvas
- GetCurrentAnimatorClipInfoCount() and GetNextAnimatorClipInfoCount() return 0 when animator is in transition
- GPU utilization increases by 20% on Meta Quest headsets when Render Graph is enabled on 6000.0.16f1 and higher
Resolution Note:
There are some misunderstandings on how the UIDocument component works here, which is due to our lack of documentation, so apologies about that.
The UXML file won't be loaded by the UIDocument component until OnEnable runs on it, so trying to access the root during Start in the NewBehaviourScript component means you may not get the root of the cloned tree. We highly suggest using OnEnable on your component to guarantee the expected behavior.
In any case, when you wait for the end of the frame through your yield return statement, that means one frame will be drawn and that one frame can contain the cloned tree. Also if I understand correctly, you want to use a USS transition to move the square after the first frame, and the preferred way of moving something on screen like that would be to register a callback to the GeometryChangedEvent and change the position of the square in the callback. That guarantees the transition will kick in since the first layout will have the square in place and when the new position is set, it'll transition to it as expected.