Search Issue Tracker
Fixed
Fixed in 2023.2.10f1, 2023.3.0b7, 2024.1.0a1
Votes
7
Found in
2023.1.7f1
2023.2.0b3
2023.3.0a3
2024.1.0a1
Issue ID
UUM-44732
Regression
Yes
"IndexOutOfRangeException" in "UIElements.Layout.LayoutManager.DestroyNode" when changing UXMLs
Reproduction steps:
1. Open the attached "repro_IN-49088.zip" project
2. Open the "Main" Scene
3. Go to "File > Build Settings..."
4. Make sure that "WebGL" is selected as the Platform and press "Build And Run"
5. When the Player opens, press on the lobby desk (it will glow when you hover over it with your mouse)
6. Press the arrow button in the top-left to go back
7. Repeat these two steps a few times
Expected result: The application runs without any issues
Actual result: The "IndexOutOfRangeException: Index was outside the bounds of the array" error is shown, the application buttons become unresponsive and show the "InvalidOperationException: Stack Empty" error after subsequent clicks
Reproduced with: 2023.1.0b4, 2023.1.7f1, 2023.2.0b3
Not reproduced with: 2021.3.29f1 (tested on macOS because the project builds only with Vulkan graphics API), 2022.3.6f1, 2023.1.0b3
Reproduced on: Windows 10, macOS 13.4 (M1, Intel)
Note: Reproducible on Google Chrome (115.0.5790.110), Firefox (115.0.2), Edge (115.0.1901.183), Opera (100.0.4815.76)
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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
KamilCSPS
Dec 27, 2023 12:37
Another user mentioned this cause and workaround. Not ideal as a solution as it may create additional issues down the road and will be hard to keep compatibility...
https://forum.unity.com/threads/invalidoperationexception-failed-to-free-handle-with-index-0-version-0-at-unityengine-uielements.1391191/#post-9547777
BadgerMeles
Dec 18, 2023 20:37
I also encountered this issue when building WebGL [Unity 2023.1.20f1], playing in Firefox 120.0.1 (64-bit).
However, I encountered it while switching between scenes (ie: Back and forth between MainMenu <-> InGame) where each scene had it's own UIDocument.
Two particular observations of note:
1) In my situation, the error only happens when LoadSceneAsync() is used - LoadScene() does not appear to cause the issue.
2) There are two different Exceptions that will be thrown at the same point, which Exception is thrown appears to be intermittent. One is the "Stack Empty" noted above, the other is "Failed to Free handle with Index=0 Version=0" noted in this related thread: forum.unity.com/threads/1391191
I tried multiple approaches, and documented everything with multiple tests and examples here:
https://github.com/BadgerMeles/Unity-WebGL-UIToolkit-Exception
If a root-cause has not already been found to resolve this issue, hopefully this additional information may be of use to you.
Please, do not hesitate to ask if you have any questions.