Cute_demon_attacks/meng_yao/Assets/UpdateChiclPosition.cs

28 lines
645 B
C#
Raw Normal View History

2024-10-23 15:35:12 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.UI;
public class UpdateChiclPosition : MonoBehaviour
{
short previousChildCount;
// Start is called before the first frame update
void Start()
{
previousChildCount = (short)transform.childCount;
}
// Update is called once per frame
void Update()
{
if (transform.childCount>previousChildCount)
{
previousChildCount = (short)transform.childCount;
transform.GetComponent<VerticalLayoutGroup>().SetLayoutVertical();
}
}
}