32 lines
772 B
C#
32 lines
772 B
C#
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();
|
|
}
|
|
} |