UI Toolkit displaying in editor but not on mobile?

I’ve just been trying to get a feel for the UI Toolkit and I feel like I’m not setting something up correctly.

I’ve included all the proper packages according to this forum post and my scene currently looks like this:

SampleScene

  • Main Camera
  • Directional Light
  • UIDocument

Following the documentation here, I’ve set up my UIDocument (game object) with:

  • Input System Event System (UI Toolkit)
  • UI Document:
  • Panel Settings: PanelSettings (asset)
  • Source Asset: SimpleUI (my uxml asset)

If I push play in the editor, my UI shows up, but when I build and run the project for iOS or Android, I only see the 3d scene. Anyone have any ideas of what I could be missing?

Here’s a link to the project if that helps.

Thanks.

Relavent Versions:

Unity – 2020.3.18f1
UI Builder – 1.0.0-preview.17
UI Toolkit – 1.0.0-preview.17
Unity UI – 1.0.0

Not sure how to directly fix what’s happening to you, but I was having trouble with UI Toolkit stuff a few weeks ago and switched to editor version 2021.2 which has all the appropriate packages installed by default. That solved all the problems I was having.

I tried a similarly made sample in 2021.2 and that worked for me too.

Going back to my original code, it seems like in the difference between 2021.2 and 2020.3 when using UI Toolkit in mobile is that they don’t seem to show automatically in 2020.3 like it does in 2021.2.

Just in-case anyone else has this issue, I resolved it by creating another GameObject in my scene with a Script component that references a UIDocument (in my example, the one that references SimpleUI) and in Start(), I updated it’s display style so that it would show:

public UIDocument uiDocument;

// Start is called before the first frame update
void Start()
{
    if (uiDocument != null) {
        uiDocument.rootVisualElement.style.display = DisplayStyle.Flex;
    }
}

Also can be usefull - some VisualElement can become visible = false for Android, although they are visible = true in editor.

UI Toolkit doesn’t render on Xiaomi 13 Pro. I tried with a completely new project, same steps as the first post. Tried recreating the panel settings asset, recursively setting every visual element to Display = Flex and visible = true, but it ain’t rendering anything.

I filed a bug report, but after it finished uploading … the UI just got stuck for a few minutes and I closed it. Doesn’t seem like it came through.

Unity - 2023.2.20