using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class N : MonoBehaviour
{
public GameObject Panel;
public void OpenPanel()
{
if(Panel != null)
{
bool isActive = Panel.activeSelf;
Panel.SetActive(!isActive);
}
}
}
现在是这样执行之后点击button出现panel,我想问下我想写再点击之后panel消失该怎么做
你这么写就是可以的,你应该是把脚本挂载到了Panel上面吧,把它挂载到其他不会被隐藏的物体上就可以了