GetComponent function returning null
问题 I'm developing a simple game in Unity 2017 in C#. In my levels menu I have a Text object with a button component in it, and a script attached to it. This is what's currently in the script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LevelLock : MonoBehaviour { public bool isLocked = true; private Button lvlBtn; // Use this for initialization void Start () { lvlBtn = GetComponent<Button> (); if (lvlBtn != null) { Debug.Log (