Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug InvalidOperationException: Failed to Free handle with Index=0 Version=0 at UnityEngine.UIElements.

Discussion in 'UI Toolkit' started by Cuku_, Jan 25, 2023.

  1. Cuku_

    Cuku_

    Joined:
    Sep 2, 2012
    Posts:
    10
    Hi,

    I'm on WebGL and using Addressables to load uxml files.
    I'm loading and instatiating one element 6 times and the first time I get the following error, but the other 5 times it works fine:

    Code (CSharp):
    1. InvalidOperationException: Failed to Free handle with Index=0 Version=0
    2.   at UnityEngine.UIElements.Layout.LayoutDataStore.Free (UnityEngine.UIElements.Layout.LayoutHandle& handle) [0x00000] in <00000000000000000000000000000000>:0

    What's interesting is that it was working fine before and I've been reverting back and forth the changes when this started happing, but there's no pattern.

    I was close to identify the issue, but without any luck:
    Maybe it was using Addressable Asset Settings - Catalog - Player Version Override (I switched back and fourth, it was fixed at some point, but the issue came back)
    Maybe because intially the VisualElement - display is none (so hidden) and mayb the Layout issue, thought it doesn't seem to be, since the other elements work fine.
     
  2. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    Started having the same issue.

    Still can't identify it. Do you mind sharing if you managed to resolve it?
    I can't reproduce in Unity 2022.x LTS. Can easily reproduce in 2023.1.x and 2023.2.x.

    Will share a bug report if there's no follow up later this week.
     
  3. vejab

    vejab

    Joined:
    Dec 21, 2021
    Posts:
    85
    I have the same issue but I don't really need a webgl build right now so I didn't investigate much and I didn't submit a bug report.
    EDIT: I don't use Addressables to load uxml files, I use Resources.Load (not sure if it's different)
     
  4. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376