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?