public class UI_RingtButton : MonoBehaviour {
public GameObject ZheZhao;
public GameObject Right_Canvas;
public void JiChu_Button()
{
foreach(Transform child in Right_Canvas.GetComponentsInChildren<Transform>(true)) //调用子物体和孙物体
{
if (child.name == "jichu")
{
if (child.gameObject.activeSelf == true)
{
child.gameObject.SetActive(false);
}
else
{
child.gameObject.SetActive(true);
}
}
if (child.name == "zuta")
{
child.gameObject.SetActive(true);
}
if (child.gameObject.name == "jiaxian")
{
child.gameObject.SetActive(true);
}
}
foreach(Transform child in ZheZhao.GetComponent<Transform>()) //调用子物体
{
if(child.name== "JiChuMuLu")
{
if (child.gameObject.activeSelf == false)
{
child.gameObject.SetActive(true);
}
else
{
child.gameObject.SetActive(false);
}
}
else
{
child.gameObject.SetActive(false);
}
}
}