| 1234567891011121314151617 |
- using UnityEngine;
- using UnityEngine.UI;
- namespace DevilLink2.UI
- {
- public sealed class UIFitLayout : MonoBehaviour
- {
- private void LateUpdate() { Apply(); }
- public void Apply()
- {
- var rect = (RectTransform)transform; var parent = transform.parent as RectTransform;
- if (!parent) return;
- rect.sizeDelta = new Vector2(ScreenLayout.Width, ScreenLayout.Height);
- rect.localScale = Vector3.one * ScreenLayout.FitScale(parent.rect.width, parent.rect.height);
- }
- }
- }
|