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?