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 PanelSettings error "Destroying an object in edit mode destroys it permanently"

Discussion in 'UI Toolkit' started by BrianAmihan, May 18, 2022.

  1. BrianAmihan

    BrianAmihan

    Joined:
    Mar 10, 2022
    Posts:
    15
    Unity_MlgYZWbRLb.png

    We are seeing this error randomly appear while using UI Toolkit. We have just begun to experiment with it so we aren't doing anything beyond displaying a simple (2 buttons and a container) UI Document in our scene with a script that handles clicks only during runtime (we aren't doing anything in our scripts that executes in the editor with UI Toolkit).

    What can we do to avoid this error?

    Unity 2021.3.2f1, I'm not sure what version of UI Toolkit I'm using. It was included in the installation and I don't see an entry in the package manager.
     
  2. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    666
    Hello!

    Since UI Toolkit for Runtime is distributed with your Unity installation and no longer a package, the Unity version is enough for us to know what version of our code we're talking about :)

    Is there anything on the Editor log when this happens?

    And if you have 2 or more UIDocuments on the scene, does it still happen? Or maybe only when you have 1 single UIDocument on the scene?

    I suspect this could be related to a different fix that we did and I'm not sure it's included in the version you are, that's why I'm asking.
     
  3. BrianAmihan

    BrianAmihan

    Joined:
    Mar 10, 2022
    Posts:
    15
    Thank you for the info.

    There is nothing else in the console when this error occurs. Attached is my editor log around when the error occurs. Nothing else jumps out at me in there but I don't understand a few of the entries around the error.

    The attached screenshot shows my setup. There is only 1 UI Document and it is pretty simple. Just a couple of buttons.

    Unity_TIIysNbxC6.png

    I haven't tried having 2 UI Documents active but I could if it would be helpful.

    I think the error occurs after I have C# code built but I can't repro it 100% of the time so I haven't figured out exactly what it is. I'm not messing with the UI Document or assets at all and the error still displays sometimes. Happy to try whatever to help track it down.

    Thanks
     

    Attached Files:

  4. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    666
    Thanks for sharing your Editor log! We have an internal bug opened for this and I've added information from here as it may be helpful.

    Is this blocking you in any way? I suspect that if you remove the event system from your scene it may stop showing up (if you don't need it, of course).
     
  5. BrianAmihan

    BrianAmihan

    Joined:
    Mar 10, 2022
    Posts:
    15
    Thank you Julia!

    This is not blocking. We just have a 0 errors/0 warnings policy (and I suspect many other studios do as well) so I'm trying to make sure UI Toolkit can pass that.

    I removed Event System and will look out for the error and report back. Thanks again.
     
  6. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    666
    Don't get me wrong, this needs to be fixed! I was just trying to understand if this could be blocking you, in which case I'd advocate for even higher priority on this.

    Glad you can still keep using UI Toolkit! :cool:
     
  7. BrianAmihan

    BrianAmihan

    Joined:
    Mar 10, 2022
    Posts:
    15
    I can confirm that I haven't seen this error pop up again since removing the Event System from the hierarchy. Thank you.
     
    JuliaP_Unity likes this.
  8. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    666
    Thank you for confirming! We've also managed to find the root cause and we're fixing for future versions of Unity :cool: