//存储菜单列表
List<GameObject> subMenu = new List<GameObject>();

//存储所有子菜单
public void StoreSubMenuData()
{
  var menu = mainMenuScreen.transform.FindChild("back/menuPanel");
  foreach (Transform kk in menu)
  {
    if (kk.GetComponent<Image>() != null && kk.GetComponent<Button>() == null)
    {
      subMenu.Add(kk.gameObject);
    }
  }
}
//隐藏所有子菜单
public void HideSubMenu()
{
  foreach (GameObject obj in subMenu)
  {
    if (obj.activeSelf == true)
    {
      obj.SetActive(false);
    }
  }
}

05-17 17:41