using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; namespace KairoEngine.Inventory { public class FollowWorldPosition : MonoBehaviour { public ItemContainerUi ItemContainerUi; public GameObject panel; public float yDistance = 2; private Transform target; void OnEnable() { } void Update() { if(panel.activeSelf) { target = ItemContainerUi.targetItemContainer.transform; if(target != null) { Vector3 pos = new Vector3(target.position.x, target.position.y + yDistance, target.position.z); Vector3 screenPos = Camera.main.WorldToScreenPoint(pos); screenPos.z = 100; panel.GetComponent().position = screenPos; } } } } }