I’ve seen this question asked a lot around here, but for some reason the answers vary depending on…things.
I’m simply trying to display the remaining player lives (int) on the HUD canvas as a UI.Text. Yet, Unity doesn’t agree with me on this. Please see my code below:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LifeDisplay : MonoBehaviour {
Text lifeDisplay;
int count;
void Start ()
{
lifeDisplay = GetComponent<Text>();
count = GameController.GetPlayerLife();
}
void Update ()
{
lifeDisplay = count.ToString();
}
}
Simple right? Well, Unity keeps calling me mean names for trying this. What am I doing wrong?
Thanks for the help!