Health Dose not display
My health bar is not displaying my players health:
Here is my code
GameObject healthText = GameObject.Find("Health Display"); //GameObject healthPoints = GameObject.Find("Health Text"); healthText.GetComponent().text = "Health: " + health.ToString();
Comment
Answer by Dsiak · Nov 24, 2021 at 01:22 AM
You are not getting any component because you didnt specify the type. Try this
healthText.GetComponent<Text>().text
Your answer
Follow this Question
Related Questions
rigidbody2D's velocity not working 1 Answer
Help with code for picking up objects 1 Answer
Unity "ArgumentExeption: The object you want to instantiate is null." need help. 0 Answers
Activate 2 gameobjects separate if there is Enemy tag C# 0 Answers
Evasive Maneuver causing Space shooter enemies to not move? 0 Answers