- Home /
Question by
Horz · Oct 03, 2015 at 07:18 PM ·
uibuttononclickruntime-generation
UI Button generated in runtime OnClick event
Hi,
So, I'm generating a Button in runtime.
var myButton = (GameObject)Instantiate(button_prefab, Vector3.zero, Quaternion.identity);
How can I assign the OnClick event in runtime? or how can I listen to button OnClick event anyhow ?
also. within that OnClick event - How can I define from which object if was called. In case the event function could be called from different buttons.
Comment