RuntimeUIElements: can't render a panel I created

I got this project:

The sample all works well as expected. However, if I create a new UI using UI Builder and create a GameObject Panel in the scene to render it, it doesn’t render.

Here’s my Test UI and the panel setup:


You can see the button is not showing in game. Is there anything special I should do to make it appear?

At start only the main menu is enabled.

// GameManager.cs
private void Start()
{
#if !UNITY_EDITOR
    if (Screen.fullScreen)
        Screen.fullScreen = false;
#endif

    GoToMainMenu();
}

private void GoToMainMenu()
{
    SetScreenEnableState(m_MainMenuScreen, true);
    SetScreenEnableState(m_GameScreen, false);
    SetScreenEnableState(m_EndScreen, false);
}

Edit: Okay, I might’ve misunderstood your question. But creating a new panel seems to work fine for me:

TestPanel has a “GGG” button.

Edit 2: It seems the new panel can disappear if you are not using the Default.uss. So I’m guessing you are supposed to use the Stylesheets array to do the cascading styles (putting Default.uss as first, then the new uss as second for any overrides/new ones).

1 Like

A couple of things to confirm:

  1. Yes, you need to use Default.uss to get basic styles (and see something on screen). It should be added to a new Panel Renderer by default though.
  2. Be aware that if you add new panels or change existing panels in the Unite demo scene you will contend with the demo’s game logic, which as noticed does change Enable states of some of the Panel Renderers. I would recommend starting with a new scene.
1 Like