Setting Event Trigger in Code not working.

If you scroll down on this page, there is an example of adding one in code: Redirecting to latest version of com.unity.ugui

Maybe that will help.

Please take a moment to look at this page for posting code in the future: Using code tags properly
It shows up nicely in the thread that way :wink:

Worth mentioning, also, that you could have a script that implements the IPointerClick interface - if that’s the one you want - and then you could use AddComponent() on your dynamically generated object.