Add initial UI Toolkit setup and schemas
This commit is contained in:
32
Assets/SimpleRuntimeUI.cs
Normal file
32
Assets/SimpleRuntimeUI.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class SimpleRuntimeUI : MonoBehaviour
|
||||
{
|
||||
private Label _forceLabel;
|
||||
private Label _timeScaleLabel;
|
||||
|
||||
[SerializeField]
|
||||
private TestScript testScript;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
var uiDocument = GetComponent<UIDocument>();
|
||||
|
||||
_forceLabel = uiDocument.rootVisualElement.Q<Label>("forceLabel");
|
||||
_timeScaleLabel = uiDocument.rootVisualElement.Q<Label>("timeScaleLabel");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_forceLabel.text = "Hello World";
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_forceLabel.text = testScript.GetTorqueForce().ToString();
|
||||
_timeScaleLabel.text = Time.timeScale.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user