- Home /
Question by
$$anonymous$$ · Jul 22, 2018 at 09:12 AM ·
uitextmeshworld space
Changing Text Mesh Pro Text in World Space using C# Script
So, I made the Player Health Number show in the UI using TextMeshPro: https://youtu.be/U_Xcy24wp1Y
This is the Script I used:
using UnityEngine; using TMPro;
public class HealthText : MonoBehaviour {
public PlayerHealthManagement _playerHealthManagement; //Needed to access the Information about the Player Health
public TextMeshProUGUI textMesh; //The UI-Text GameObject that Displays the Current Player Health
// Use this for initialization
void Start ()
{
//textMesh = GetComponentInChildren <TextMeshProUGUI>();
}
// Update is called once per frame
void Update ()
{
textMesh.text = _playerHealthManagement.playerHealth.ToString(); //Display the Player Health
}
}
I also want to Display the Number of Health Points over the Player's Head, too.
What do I have to Change (except for
using 3D Object -> Text Mesh Pro Text instead of UI -> Text Mesh Pro Text
Using a Different Name for the Script )
in order to Display the exact same Text (in this Instance, the Health Points) also in World Space?
Comment