Building project via command line results in Label objects not displaying text

If I run the project in the editor, or build the project through the editor menus ‘File’ > ‘Build Settings…’ > [Build] and run the produced .exe there are no issues.
Building the project via the windows command line with the following command
"C:\Program Files\Unity\Hub\Editor\2020.3.6f1\Editor\Unity.exe" -quit -batchmode -logfile unity_build.log -projectPath ".\_UnityProject" -executeMethod BuildScript.PerformBuild

The resulting is that when running the .exe there is no text rendered by any controls which have a UnityEngine.UIElements.Label (so the label component of a button, toggle, slider ect…) do not display at all. I can tell that it is not a matter of the text being transparent because the size of some buttons that have Flex.Shrink = 1, and Flex.Grow = 1, result in the buttons being very small. The spacing between some UnityEngine.UIElements.Toggle controls also has very little gap between the actual tick box components, indicating the text is just missing.
Typing into a UnityEngine.UIElements.TextField displays no text at all, but after typing I can press ctrl+a, ctrl+c and paste the text into something outside the game, so there is actual data present for the text values of the controls.

All of the controls that have this issue are designed in one set of .uxml / .uss files. The styles from the .uss file work as far as :hover & :active styles for buttons, and the overall layout of the controls. Many of the buttons open another window, where the contents of the window are a mixture of the base UnityEngine.UIElements controls or custom controls that I’ve created. The windows opened by the individual buttons are all designed with their own .uxml/.uss and All of these windows work just fine. The issue is purely limited to the ‘MainPanel’.

The issue is present in the resulting .exe from the command line build, no matter what machine (windows platform only) it is run on.
How can I troubleshoot this further?

Hi @AChrapko !

Thanks for bringing this up. Could you share your logs ? Also, what font are you using?

Hello @HugoBD-Unity

The font being used throughout all of the .USS files in the project is one which we have included the .ttf file within the package resources. A coworker chose the font, I think we may have obtained it from the asset store- I’m not certain though.
A snippet from the ‘MainPanel.uss’ with missing text

.tabButtonStyle {
    height: 100%;
    width: 150px;
    -unity-font: url('/Packages/viewer-ui/Resources/Fonts/Roboto-Regular.ttf');
    color: white;
}

And from a separate .USS file with working text (one of the windows opened by clicking a button from the MainPanel

.connectionWindowStyle {
    width: 100%;
    height: 100%;
    display: flex;
    -unity-font: url('/Packages/viewer-ui/Resources/Fonts/ROboto-Regular.ttf');
}

These two .USS files both exist in the same package, which is either linked to our Artifactory server, or a local copy of the package- in both instances the text fails to display.

As for the logs, do you mean the Player.log file, or the unity_build.log that is produced as a result of the command line build?[/code]

Could you share both?

Attached are the logs from the server build via the command line (unity_build.txt) - I replaced some of the urls and namespaces.
Player.log.txt is from a run of the application with missing text (and has errors to corroborate that)

WorkingText_Player.log.txt is from running the executable that was produced from building in the Unity Editor.

So there is a clear difference in the Player.log files, but I am not sure how I can troubleshoot the application outside of the editor. I guess maybe setting the Debugger in Visual Studio to start an external program… I’ll give that a shot while I await your reply.

7271506–878155–unity_build.txt (4.63 MB)
7271506–878158–Player.log.txt (18.6 KB)
7271506–878161–WoringText_Player.log.txt (1.42 KB)

From the logs, it seems like the PanelTextSettings are invalid… What does your PanelTextSettings look like in your PanelSettings? Is it a custom one or the default one?

Also, which version of the com.unity.ui package are you using?

1 Like

PanelTextSettings are from /Assets/UI Toolkit/Default UITK Text Settings.asset

I’m not sure what the com.unity.ui package gets named as in the Package Manager, but we’re using 1.0.0-preview.14 for UI Toolkit & UI Builder.
The project manifest lists "com.unity.ui": "1.0.0-preview.13", so I’m a little confused about that.

"com.unity.collab-proxy": "1.3.9",
    "com.unity.ide.rider": "2.0.7",
    "com.unity.ide.visualstudio": "2.0.8",
    "com.unity.ide.vscode": "1.2.3",
    "com.unity.render-pipelines.universal": "10.5.0",
    "com.unity.test-framework": "1.1.26",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.4.8",
    "com.unity.ugui": "1.0.0",
    "com.unity.ui": "1.0.0-preview.13",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"

7271710--878212--upload_2021-6-25_11-48-23.png

7271710--878197--upload_2021-6-25_11-42-35.png

Hi Andrew!

Your settings look correct. Unfortunately, I would need to investigate further, could you log a bug through Help/Report a bug… ?

Thanks for bringing this up!

I am currently uploading the bug report- I included a screenshot of a non-working (command line), and working (unity editor) build in the report, so I figured I would post that here as well.

I do agree, that the logs clearly indicate an issue. Is there any way to get the logs to show some more detail, like a timestamp / source file / function / line number? If I were able to figure out a method of replicating the issue within the editor it would be much much easier to troubleshoot as I could simply step through the code with an attached debugger :frowning:

Thanks for taking the time to respond.

1 Like

@HugoBD-Unity

It turns out that there is some issue when performing a build from the command line on a project which has no Library.

Part of my organizations build process is to pull from Bitbucket a repository that only has the: ‘Assets’, ‘Packages’, and ‘ProjectSettings’ directories for our base scene in Unity, and then it pulls all of our packages from various repositories to build the entire standalone application.
The resolution was to perform the command line build twice as part of the build job, to ensure the Library exists at the time of the second build.

I was able to replicate the issue on 4 separate machines by deleting all directories (and their contents) other than ‘Assets’, ‘Packages’, and ‘ProjectSettings’.
After performing a CMD build on each of the 4 machines, they all produced standalone builds with the same issue, and running the CMD build a second time resolved it.

I updated my Unity Bug report with the detailed steps as well.

2 Likes