Hi,
I have some issue that I am starting to think is not my error. I load same scene with ui toolkit and it seems that if there is animation transition going on when load mouse button is clicked it throws null ref error and then proceeds to spam “item with same key has already been added” errors. This locks animated transitions for the life of game, updating ui manually still works. Disabling Ui Document while keeping custom script enabled makes it go away.
Can reproduce now. 2 ui documents at same scene have transition. Loading scene during transition triggers errors. Waiting past the transition loads scene as it should.
Deleting one ui document and then hitting play → Loading scene during transition works without errors
There are a ton of bugs with transitions. Two I remember are that changing the sort order of two panels together throws an exception, and that changing the sort order of a panel cancels any transitions on elements in it. Additionally transition events sometimes randomly (ie I haven’t figured out the exact cause) don’t fire.
Experiencing this as well. Additively loading a scene while an existing transition is going on will give exception at VisualElement.UpdateCallbackParentCategories() like in the OP. (Unity 2022.1)
My current workaround is to set style.transitionProperty to null for any VEs with ongoing transitions before any call to load new scene.
Setting style.transitionProperty to null doesn’t seem to end the existing ongoing transitions… Tried setting StyleList with StyleKeyword.None, and still no go.
Anyone knows the proper way of explicitly stopping ongoing transitions?
Ahaha… I stopped caring about that the moment Neutron above mentioned that there are lots of problems with transitions. I only animate opacity so I do that manually in script.
It is marked “Won’t Fix”. So yeah… They also changed description a bit. I think I also wrote it stops all transitions from working for the lifetime of the game, loading a scene will not help. Only exiting the game and starting again fixes it. But whatever. Who needs that end game menu screen appearing anyway.
As for workaround… Use one UI Document. Looked like the bug does not show up then.
Or maybe try beta. Maybe they fixed it there. I do not plan on returning to transitions so I do not know if it is fixed or not
Or stop using transitions and animate them manually.
@Takeguro Thanks for getting back to me! Strange that Unity replied with “Wontfix”. At least in my mind, it should be the Engine’s job to gracefully kill any ongoing transitions when loading new scenes. Hopefully, they’ll re-evaluate this.
UPDATE: Just tested in 2022.2b9 (latest beta right now). The bug is fixed (at least for my use case).
Good to know. As for “wont fix”, looking at the issuetracker page again, bug was not reproduced in 2023 alpha so possibly got fixed or something got changed and the issue vanished. So worst case scenario it would vanish in 2023 release.
The bug has been classified as won’t fix because it is already fixed in the 2022.2 and 2023.1 development branches. Normally the QA process would have to find exactly what pr did solve the issue to get the “resolved with” message, and it seems that in this case someone did take a shortcut as it was already fixed and there would be no actual difference other than the incomplete resolution message.
I also had issues with animation transition. My thread LINK
Reordering UIDocuments solved my issue but now I have two documents with transitions and everything is back. It’s frustrating. Unity 2022.2.1f1 and it still exists.