Search Unity

UI Documents and LoadSceneAdditive

Discussion in 'UI Toolkit' started by Polyfemos, Jul 2, 2022.

  1. Polyfemos

    Polyfemos

    Joined:
    Nov 13, 2020
    Posts:
    25
    Hi,

    I have a setup with a Uberscreen that contains popup and error messages, which is the first scene loaded at startup. This scene then loads the Title Screen (addivitive load) that contains it's own UIDocument for all interactions in the title screen.

    This kind-of works; the UIDocument in the async loade Title Screen is displayed but it can't understand mouse movements; which is easy to see due to the lack of reaction on :hover etc.

    Anyone know how to fix this? Or what a better approach is? I have tried to make a single UIDocument with the UberScreen modal popups and Titlescreen UI, but then I fail to get the popups to appear on top (instead the CSS layout engine is pushing them to the bottom), and the entire TitleScreen UI is squashed into the top 50% of the screen.

    Any input appreciated. Thank you!
     
  2. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    I can only guess, because it depends on the concrete UXML used for each UIDocument. But if you work with multiple UIDocuments, you can can define the "Sort Order" in the inspector. UIDocuments with higher sort order can absorb mouse events so other UIDocuments don't get them. This happends if the UXML has elements which span over the entire screen, even if the elements are empty. Then you have to set the "Picking Mode" in the UXML to ignore for these elements to avoid that the emptiness gets the mouse events. Then UIDocuments with lower "Sort Order" can handle the mouse events instead.
     
    Polyfemos likes this.
  3. Polyfemos

    Polyfemos

    Joined:
    Nov 13, 2020
    Posts:
    25
    Thank you! Fantastic description, and lots of useful keywords for me to use if I need to google more. THANK YOU AGAIN! This first issue was indeed caused by a transparent Visual element I had used to position a popup window in the UberScene.
     
    FaithlessOne likes this.