using System; using System.Linq; using UnityEngine; using UnityEngine.UIElements; public class GameUI : MonoBehaviour { private UIDocument document; private void OnEnable() { document = GetComponent(); PreparePlayerPanels(); } void PreparePlayerPanels() { var players = document.rootVisualElement.Children().Where(e => e.ClassListContains("player_panel")); float heightPercentage = Dimensions.Singleton.panelHeightPercentage; foreach (var playerPanel in players) playerPanel.style.height = Length.Percent(heightPercentage); } }