![](https://i-blog.csdnimg.cn/blog_migrate/24e8e8658f772e5ee07c2b4a0b3fda11.png)
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class FoldableMenu : MonoBehaviour
{
private RectTransform content;//父物体的parent
private TextAsset textAsset;//所有菜单信息
private RectTransform parentRect;//父菜单的prefab
private RectTransform[] parentArr;//所有父菜单的数组
private RectTransform childRect;//子菜单的prefab
private Vector3 parentOffset;//单个父菜单的高度
private Vector3 childOffset;//单个父菜单的高度
private int[] cntArr;//所有父菜单拥有的子菜单个数
void Awake()
{
Init();
}
void Init()
{
content = transform.Find("Viewport/Content").GetComponent<