Files
Studio/Assets/Scripts/Studio/UI/TreeView/PopupScrollViewMenu.cs
2025-05-08 12:02:05 +09:00

46 lines
1.2 KiB
C#

using TMPro;
using UnityEngine;
using XED.HierarchyTree;
namespace XED.UI
{
public class PopupScrollViewMenu : MonoBehaviour
{
private HierarchyScrollRect scrollRect;
private Canvas canvas;
// Start is called before the first frame update
void Awake()
{
canvas = GetComponentInParent<Canvas>();
scrollRect = GetComponentInParent<HierarchyScrollRect>();
scrollRect.menuPopup = gameObject;
gameObject.SetActive(false);
}
private void OnEnable()
{
RectTransformUtility.ScreenPointToLocalPointInRectangle(
canvas.transform as RectTransform,
Input.mousePosition,
canvas.worldCamera,
out Vector2 pos
);
transform.position = canvas.transform.TransformPoint(pos);
}
private void OnDisable()
{
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}