using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class energiaText : MonoBehaviour
{
Text text;
vida vidaText;
void Start()
{
vidaText = GetComponent<vida>();
}
// Use this for initialization
void Awake()
{
text = GetComponent<Text>();
}
// Update is called once per frame
void Update()
{
text.text = "Energia: "+ vidatText.life1;
}
//===========================
//other class
using UnityEngine;
using System.Collections;
public class vida : MonoBehaviour {
public float life;
void Update () {
life = life + 1;
}
}
//------------------------------------
NullReferenceException: Object reference not set to an instance of an object
energiaText.Awake ()
//------------------------------------
the variable life does not pass to class โenergyโ to be displayed in text Ui
The text does not mark anything help me please