thewar_client/Client/Assets/1_Script/ImgaeSizeSet.cs

19 lines
558 B
C#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEditor.VersionControl;
using UnityEngine;
public class ImgaeSizeSet : MonoBehaviour
{
private void Start()
{
RectTransform rt = gameObject.GetComponent<RectTransform>();
RectTransform changeRt = gameObject.GetComponentsInChildren<RectTransform>()[1];
float sizeSet = (rt.sizeDelta.y / 2) - 10;
changeRt.offsetMin = new Vector2(-sizeSet, 10.0f);
changeRt.offsetMax = new Vector2(sizeSet, -10.0f);
}
}