Small GUI problem.

Hello everyone, Im having a small GUI label problem that I hope someone can help me with. In my 2D game I have a gameobject, lets call it block. I am trying to display a GUI.Label over the block. That is to say, I am trying to lock the GUI.Label directly in front of the gameobject ‘block’ even if ‘block’ moves in the XY plane. The problem Im having is actually getting the Label to stay attached to ‘block,’ due to the way GUI’s positions work (i.e. ‘block’ is at position 0.1,-4 which is in the bottom centre, but at this same position the GUI.Label is in the top left corner). so Im hoping someone could please give me a suggestion as to how to “lock” the GUI.Label over the ‘block’ gameobject. Thanks in advance :slight_smile:

Make the label a child of the parent object and lock the transform relative to the object?

You need to call Camera.WorldToScreenPoint() to transform your 3D world GameObject position to screen space and use it to position a GUI.Label or anything you want ! You’ll need a little math because Screen’s projected space is Bottom left (0,0).