1
This commit is contained in:
40
Unity/Scripts/Debuger/UIDebuger.cs
Normal file
40
Unity/Scripts/Debuger/UIDebuger.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user