using UnityEngine; namespace DiamondArrow { public sealed class SafeCanvas : MonoBehaviour { public RectTransform content; void LateUpdate() { Apply(); } public void Apply() { if(content==null)return;float scale=1f/Mathf.Max(.001f,GetComponent().scaleFactor);Rect s=Screen.safeArea; content.anchoredPosition=new Vector2((s.center.x-Screen.width*.5f)*scale,(s.center.y-Screen.height*.5f)*scale); content.localScale=Vector3.one*Mathf.Min(s.width*scale/750,s.height*scale/1334); } } }