Scripting an image button

Hello, i have a prefab which is an image and creates a map in a loop and i want to attach a click receiver.

Right now it looks like this (this is not the complete code just a part to give you an idea)

for (int y = 0; y < resolutiony; y = y + 1)
{
for (int x = 0; x < resolutionx; x = x + 1)
{
if (modus == 2) { displaymap(i, x, y); }
private void displaymap(int i, int x, int y) {
Sprite mysprite = UnityEngine.Resources.Load<Sprite>("Tiles/" + str(tiname));
GameObject o = Object.Instantiate(hexbasetile);
o.GetComponent<Image>().sprite = mysprite;
o.transform.localPosition = new Vector2(((x * xbase)+xdbase), (y * ybase));

Now i want to attach something like this:

On Click call beenclicked(o);

private void beenclicked(GameObject o){

The tutorials on this are extremely thin.
How can i do this from code side?

If I got this right you map of hex tiles each tile is an object you want to give a class the ability to tell if specific tiles were clicked on. you could attach a class to each tile give it a reverence to the class that will use been clicked. Attach a colider and then use the onmouse () monobehavior method to call the beenpressed function and send its own game object as a parameter.

Or you can also use delegats and events aswell.
Hope this helped

Thankyou i guess thats an good approach but i dont know how you mean give a reverence, how to configute onmouse() of a collider in script.since i have not worked much with events and classes i dont know how it would look.in code.

Same for delegats and events. Like i said i have trouble to find something useful in the tutorials.

How would code with delegates and events look like?