스페이스바 누름 구현

This commit is contained in:
김도환
2026-05-01 04:03:39 +09:00
parent 425863e9c9
commit 162b58c17d
392 changed files with 115972 additions and 1142 deletions

View File

@@ -0,0 +1,29 @@
using UnityEngine;
using UnityEngine.UI;
public class NewMonoBehaviourScript : MonoBehaviour
{
private GridLayoutGroup _gridLayoutGroup;
private RectTransform _rectTransform;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
_gridLayoutGroup = GetComponent<GridLayoutGroup>();
_rectTransform = GetComponent<RectTransform>();
}
// Update is called once per frame
void Update()
{
var max =
(_rectTransform.rect.width / (_gridLayoutGroup.cellSize.x+_gridLayoutGroup.spacing.x)) *
(_rectTransform.rect.height / _gridLayoutGroup.cellSize.y+_gridLayoutGroup.spacing.y);
var current = transform.childCount;
if (current / max >= 0.8f)
{
_gridLayoutGroup.cellSize = new Vector2(_gridLayoutGroup.cellSize.x * 0.9f, _gridLayoutGroup.cellSize.y * 0.9f);
}
}
}