Search Unity

Styles not showing in main menu scene of build, but works well in editor

Discussion in 'UI Toolkit' started by Vertig0, Apr 6, 2020.

  1. Vertig0

    Vertig0

    Joined:
    Oct 20, 2018
    Posts:
    6
    Hello! I'm using UIElements/UI Toolkit at runtime with Unity 2020.1.0b4 and UIElements Runtime preview 0.0.4. It's been working quite well with some minor discrepancies, but now I've found a problem where it just doesn't style my menu correctly when the game builds.

    I have two scenes, MenuScene and GameScene. They have one UIElement panel each, with their corresponding UI elements. It works great for both scenes when running the game in the editor, but when I build my game, the MenuScene renders my buttons with no styling. The GameScene still works well with all styles applied.

    I have my UXML and USS in the Assets/UI folder.

    This is how it looks without styling:

    And it should look like this:



    Any ideas? I know I'm out on a limb using all these preview packages, but it's been working great on all other accounts so far, so I'm hopeful. Let me know if you have any ideas!
     
  2. Vertig0

    Vertig0

    Joined:
    Oct 20, 2018
    Posts:
    6
    Ok, I actually found the answer myself just after posting this. For some reason, I had a lot of weird characters in my UXML file, for example
    '
    instead of
    '
    .

    I'm not sure how that happened, but maybe it got messed up between upgrading versions or something like that.
     
  3. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Glad you got it working. And thanks for the feedback.

    The UI builder may try to escape characters. Let us know if you have reliable repro steps.