using TMPro; using UnityEngine; using XED.Hierarchy; namespace XED.UI { public class PopupScrollViewMenu : MonoBehaviour { private CustomScrollRect scrollRect; private Canvas canvas; // Start is called before the first frame update void Awake() { canvas = GetComponentInParent(); scrollRect = GetComponentInParent(); 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() { } } }