40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
namespace BITKit
|
|
{
|
|
public class UIDebuger : MonoBehaviour
|
|
{
|
|
public static VisualElement root;
|
|
public static VisualElement Get()
|
|
{
|
|
VisualElement visualElement = new();
|
|
root.Add(visualElement);
|
|
return visualElement;
|
|
}
|
|
public static void Release(VisualElement element)
|
|
{
|
|
root.Remove(element);
|
|
}
|
|
public float scale = 1;
|
|
public bool display = true;
|
|
public void SetScale(float scale)
|
|
{
|
|
this.scale = scale;
|
|
if (BehaviourHelper.Actived)
|
|
root.transform.scale = new(scale, scale, scale);
|
|
}
|
|
public void SetDisplay(bool display)
|
|
{
|
|
this.display = display;
|
|
root.SetActive(display);
|
|
}
|
|
void Awake()
|
|
{
|
|
root = GetComponent<UIDocument>().rootVisualElement.Q("Root");
|
|
SetScale(scale);
|
|
SetDisplay(display);
|
|
}
|
|
}
|
|
} |