using UnityEngine; using UnityEngine.UI; public class ShieldRelocator : MonoBehaviour { public Transform pcAnchor; // PC 화면 위치 public Transform mobileAnchor; // 모바일 버튼 내부 위치 void Awake() { bool isMobile = Application.isMobilePlatform; Transform targetParent = isMobile ? mobileAnchor : pcAnchor; transform.SetParent(targetParent, false); RectTransform rect = GetComponent(); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.anchoredPosition = Vector2.zero; LayoutRebuilder.ForceRebuildLayoutImmediate(rect); } }