Search Unity

Bug After a while, UI Element disappeared

Discussion in 'UI Toolkit' started by CabinIcarus, Aug 28, 2020.

  1. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    The game is hung in runtime mode in the editor. I went to play a mobile game and came back to find that the UI element disappeared,was released?

    UI Element Runtime Version:1.0.0-preview.6

    Unity Version : 2020.2.0a16

    It should be about half an hour later(What exists now is UGUI):
    upload_2020-8-28_19-18-53.png

    Normal:
    upload_2020-8-28_19-19-46.png
     
    Last edited: Aug 31, 2020
  2. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    The problem is not because of a long-term problem, but because multiple UIDocuments exist, and then all UIDocuments before him are destroyed, the problem will occur
     
  3. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    Reproduce the problem
     

    Attached Files:

  4. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    1.0.0-preview.7 this bug Still exist

    unity version:2020.2.0a21
     
  5. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    698
    Hello, without looking at the project/code it's really hard to tell what could be wrong!
    Also this message is not clear to me:

    Do you mean that there are UIDocuments that are getting destroyed? By your code? Some other way?
     
  6. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    I am getting a similar issue when I made a menu system. The UIDocuments in my case are setting style.display to none on the root element, nothing is getting destroyed. I submitted a bug report already for this and it was confirmed.
    https://issuetracker.unity3d.com/is...ot-visible-after-being-pressed-multiple-times. It's not just button elements but all elements, not sure about the teleporting to 0,0,0 cause I can still interact with the UI with it not showing up. Everything is where it should be, just not shown.
     
  7. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    The hierarchical structure was destroyed before him, it was not destroyed by itself,code It's just that the Root Display of UIDocuments before him is set to `None`,In the third reply, I recorded a GIF to demonstrate how to quickly reproduce the problem. Create multiple UI documents and then destroy the previous uidocuments to reproduce the problem
     
  8. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    The link could not be opened
     
  9. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    698
    I can't really understand from the gif what's happening, would you mind typing in the steps? I'm not clear on what's happening but surely want to figure out if UIDocuments are going missing :confused:
     
  10. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72

    I wrote a simple project. You can take a look at it. It is slightly different from how the problem occurred in my project, but it can trigger this problem. I cannot simulate the way the problem occurs in my project. Sorry ==, The way my project appears is very simple, that is, open the ui and then destroy the previous ui, but I cannot trigger the problem in this way in this project.

    You can right-click the `UIDocumentsTest` component and click `Auto` to see the result, or you can see how I triggered this problem step by step in the gif
     

    Attached Files:

  11. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    I solved this problem by instantiating `panelSettings`

    Code (CSharp):
    1. void Awake()
    2. {
    3. GetComponent<UIDocument>().panelSettings = Instantiate(GetComponent<UIDocument>().panelSettings);
    4. }
    5.  
     
  12. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    698
    Hello, I came back with feedback that this is obviously a bug, but there have been changes that will address this. Not sure the next version coming out necessarily has a fix, but the one after that for sure. Thanks for all the information you provided! :cool:
     
  13. CabinIcarus

    CabinIcarus

    Joined:
    May 24, 2017
    Posts:
    72
    You're welcome