Problem with executing code after clicking on correct answer

Hi guys,
I am basically trying to execute code after I click on a correct answer (that I assigned to first answer in list). However the code executes right at the start, not when I click on the answer.

I think I do understand why it is doing that, my question is how else should I approach this ? It feels so simple and yet I have been stuck on it for quite some time. How would I execute the code after clicking on the correct answer? Any ideas? Thanks a lot in advance… here is a code > (btw I have a canvas with buttons on which I loaded the list)

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;

public class QuizLearning : MonoBehaviour {
	public List <string> QnA = new List <string>();
	public GameObject parentCanvas;
	public int correctAnswer;

    void Start () 
	{
		QnA.Add ("Where is Rome?");
		QnA.Add ("Italy");
		QnA.Add ("France");
		QnA.Add ("Spain");
		QnA.Add ("Norway");

		AddText ();

		QnA [1] = correctAnswer.ToString (); // italy equals correct answer
		OnMouseDown (correctAnswer); // i want to call a method that will execute code` after I click on "italy" button
	}

	void AddText () 
	{
		int i = 0;
		foreach (Text t in parentCanvas.GetComponentsInChildren<Text>()) 
		{
			t.text = QnA*;* 
  •  	i++;*
    
  •  	// this just loads the list on buttons*
    
  •  }*
    

}

  • void OnMouseDown (int answerCorrect)*

  • {*

  •  parentCanvas.gameObject.SetActive (false);*
    
  •  Debug.Log("whatever");* 
    

// I want this code to execute AFTER I click on “italy” button, but it executes right at the start

  • }*
    }

First i need to say that this way require using of unity standart button gameobject (that came with new unity UI system):

GameObject Button;
void Awake()
{
  Button.GetComponent<Button>().onClick.AddListener(() => { Method_To_Call(); });
}

I can’t give more detailed example, but you have base line of code that execute method after click on button. Recommend to learn about UI BUTTON