Hi.
A simple function of gameover with some buttons. When the player dies, i’m trying to turn on butons like retry, change character and so on. The weird is the MonoDevelop doesn’t recognize the Button component and I can’t make then interactable.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameOverController : MonoBehaviour {
Button myButton;
void Awake () {
myButton = GameObject.Find ("My Button").GetComponent<Button>();
}
void ButtonOn () {
myButton.interactable = true;
}
}
Whenever I try to call ButtonOn() I got this error: Type Button' does not contain a definition for
interactable’ and no extension method interactable' of type
Button’ could be found (are you missing a using directive or an assembly reference?).
Else, if I try other common variables, like .enable, I get a NullReference error, as like myButton was null.
Sorry for any mistyping, it’s my first post/question ever.