🌈 搜索
📅  最后修改于: 2022-03-11 14:49:06.300000             🧑  作者: Mango
Button button = myButton.getComponent(); //next, try any of these: //In Unity 5.6 this doesn't work button.onClick += myMethod; //Use this instead button.onClick.AddListener(myMethod); //Didn't test it button.onClick.AddListener(delegate{MyMehtod();}) //this will unlikely work button.onClick.AddListener(() => {MyMethod();});