This commit is contained in:
CortexCore
2023-06-05 16:25:06 +08:00
parent 9027120bb8
commit 4565ff2e35
2947 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace BITKit.UX
{
public class UGUIAncher : MonoBehaviour
{
public UXElement element;
public RectTransform rect;
void FixedUpdate()
{
var ve = element.GetVisualElement();
var pos = ve.worldTransform.GetPosition();
var size = ve.layout.size;
if (size.x is not float.NaN)
rect.sizeDelta = size;
if (pos.x is not float.NaN)
rect.anchoredPosition = new(pos.x, -pos.y);
}
}
}