之前一直使用在脚本内写setactive(false)的方式关闭panel , 今天才学到直接在button里选择setAvtive就可以,下面是详细步骤 1.图中Bag是面板panel, closeButton是关掉此Panel的按钮 2.Bag面板放在closeButton的这里 3.点击closeButton的下图位置 4.选择setActive函数,当面板出现时,点击closeButton就可以直接关闭此界面了