Question by
rainbow_design · Sep 12, 2015 at 04:23 PM ·
c#unity 5button
How to catch events from scripted buttons
I have an Button:
mybutton.OnPointerClick()
and a function
public void mybuttonpressed(somevariable)
What is the syntax to make a click on mybutton call the function mybuttonpressed?
Comment
$$anonymous$$aybe a little sidenote i am trying this on python and writing or extending classes will add quite a layer of complexity so i would like to solve this with functions.
Best Answer
Answer by rainbow_design · Sep 13, 2015 at 05:28 PM
Thanks i found the solution:
it looks like
prt=partial(myfunction,*(enter[item],0))
mybutton.OnClick.AddListener(prt)
for me, for C# partial would be delegate.