Using get component on button and still being able to set interactable to false?

I’m getting the error: Cannot implicitly convert type UnityEngine.Component' to UnityEngine.UI.Button’. An explicit conversion exists (are you missing a cast?)

Basically, I’m getting a list of level buttons as children of the gameobject that the following script is attached to. Everything is working except for the part where I’m trying to set the buttons to interactable = false. The code in full (and the part that isn’t working after):

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

public class LockedLevels : MonoBehaviour {

	public List<GameObject> Children; 

	// Use this for initialization
	void Start () {

		//Get all children names parsed down to level int.
		foreach (Transform child in transform) {
			if (child.tag == "Level") {
				Children.Add (child.gameObject);
			}
		}

		foreach (GameObject child in Children){
				string name = child.name;
				int level;
				string newString = "";
				foreach (char c in name) {
					if (int.TryParse (c.ToString (), out level)) {
						newString += c.ToString ();
					}
				}
				level = int.Parse (newString);


				//Now use level numbers to set button inactive and text inactive for locked levels.
				if (level > Keepers.keepers.maxLevel) {
				Button levelButton = child.GetComponent("Button");
				levelButton.interactable = false;
				child.transform.Find ("Text").gameObject.SetActive(false);
				}
		}
	}
}

Again, the only two lines not working due to the error described above are:

Button levelButton = child.GetComponent("Button");
levelButton.interactable = false;

I know the child portion is working because the line right after that sets the text to inactive is working. The text does go inactive if I “turn off” the two lines of code about the button itself.

Am I calling the button incorrectly? Isn’t it technically a component?

Thanks in advance to anyone having the time to look at this and help out. :slight_smile:

will it work if you write

 Button levelButton = child.GetComponent<Button>();

instead of GetComponent(“Button”)