Dynamically added button component to game object not working!

Just used Unity for a week. So I’m trying to get a children from an object parent then add a click event to them. Click is not working.

void Start () {
		Transform trans = level.transform;
		foreach(Transform child in trans)
			myList.Add (child);

			//print (child.name);
			GameObject objs = child.gameObject;
			objs.AddComponent<Button> ();

			objs.GetComponent<Button> ().onClick.AddListener(() => ButtonClicked(child.name));

void ButtonClicked(string n){
		print (n);

Button is a UI Component, so if these children aren’t in the UI they will not work.
To make a button outside the UI, use Raycast together with Input to verify if the player is clicking and get the object beneath the mouse position.