Quantcast
Channel: UGUI & TextMesh Pro
Viewing all articles
Browse latest Browse all 23263

How to AddListener() featuring an argument?

$
0
0
Code (csharp):
  1. // So, I can add a listener via code by method name with
  2. button.onClick.AddListener(SomeMethodName);
  3. // but can't include an argument?
  4. button.onClick.AddListener(SomeMethodName(SomeObject));
I noticed this custom events solution in the FAQ's - is that the best way to achieve sending any kind of argument? Given my argument inherits from MB - in keeping with the rules of what arguments events can have - I feel I'm...

How to AddListener() featuring an argument?

Viewing all articles
Browse latest Browse all 23263

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>