继承了MonoBehaviour类 transform.GetComponent<Button>().enabled = false; 这样可以禁用物体上的Button组件,想禁用别的组件也是一样的写法