万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

NGUI UnityでボタンのEventDelegate

ボタンに引数を入れる方法について

            List<EventDelegate> list = new List<EventDelegate>();
            EventDelegate myDelegate = new EventDelegate ();
            myDelegate.target = this;
            myDelegate.methodName = "OnTap";
            list.Add (myDelegate);
            EventDelegate.Parameter param = myDelegate.parameters[0];
            param.obj = go;
            hogeButton.onClick = list;

今回は、param.objにgoというものを入れた。
goは別で定義しているGameObject。
hogeButtonは、対象となるUIButton