I know there is a lot of these kinds of questions but they are all for older versions of unity, that don’t work with unitys new UI system. The major obstacle i’m trying to get across is that I can’t use game objects or really do anything through the hierarchy for the game i’m working on.
void OnGUI()
{
GUI.color = Color.red;
GUI.Label(new Rect(unitXPosition, unitYPosition, 150, 20), health + "/" + maxHealth);
}
this is really all of the code that I am using unityYPosition and unitXPosistion just update in the update function to change there floats to the gameobjects corresponding axis value. Currently the texts moves with the gameobject but it only ever stays in the top left corner.