using UnityEngine; using UnityEngine.UIElements; public class ProgressBar : MonoBehaviour { public VisualElement progressBarFill; private float progress = 0f; void Start() { var root = GetComponent().rootVisualElement; progressBarFill = root.Q("progressFill"); } void Update() { // Update progress value here progress += Time.deltaTime * 0.1f; // Example increment progress = Mathf.Clamp01(progress); // Update the width of the progress bar fill progressBarFill.style.width = new Length(progress * 100, LengthUnit.Percent); } }