Search Issue Tracker
Fixed
Fixed in 2023.2.10f1, 2023.3.0b7, 7000.0.0a1
Votes
7
Found in
2023.1.7f1
2023.2.0b3
2023.3.0a3
7000.0.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
- Shader warnings are thrown after building High Definition 3D template
- "EndLayoutGroup: BeginLayoutGroup must be called first" error is thrown when changing Shader Precision Model from the Build Profiles window
- White artifacts/outlines are visible in the Garden Scene when viewing at meshes from a distance
- Shader warnings "Sprite-Unlit-Default" are thrown after building 2D Platrformer Microgame Template
- [Android] HLSL shader becomes corrupted when running on an Android device
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.