I have my UI Document Component set to use my .uxml file as its source asset, looking at the game view its displaying the UI correctly.
However, when I run the project, that same .uxml file suddenly shrinks.
This is the code that runs.
I know that it is loading and instancing the uxml that is already set in the inspector, its just a way to guarentee the correct uxml is always used
public class ConfigurationEditor : MonoBehaviour {
UIDocument _doc;
void Awake() {
_doc = GetComponent<UIDocument>();
LoadEditorUI();
}
void LoadEditorUI() {
var visualTree = ResourceHelper.LoadEditorUXML();
var instance = visualTree.Instantiate();
_doc.rootVisualElement.Clear();
_doc.rootVisualElement.Add(instance);
}
}```