The structure is following:
-PopupWindow(parent)
–HealthValue(child,text) + component with UIText set to HealthValue game object
public class References : MonoBehaviour {
public GameObject UIText;
public Text Ref_TextValue;
void Awake() {
Ref_TextValue = UIText.GetComponent<Text>();
}
}
I need popup to be hidden from the start but with values set from script.
But if I uncheck “Active” checkbox on popup parent game object - I get NullReferenceException when trying to reference Ref_TextValue through HealthValue.GetComponent().Ref_TextValue.
It works good if active checkbox on parent is on.
Am I missing something?
You cannot reference a game object if its parent is inactive?
Can I make popup game object invisible from the start and making it visible on the run?