Tom Francis mentioned in one of his tutorials about how to have HUD style GUI elements appear over objects on the screen. The tricky part is accounting for view movement and rotation. He posted code you can use in a blog entry, but I thought it might be a good exercise to try it out in a little example. In case anyone would like to see his script in action, I’ve posted the code on dropbox here:
I kept it as brief as possible so that you can see the code in action, it just displays two enemies and a player, with GUI elements displayed over the enemies. The view rotates so that you can see that the GUI elements stay in place. The code from Tom Francis’s blog entry that does the calculation of the GUI x and y for the object are contained in a script that takes the object x and y as arguments, and puts the GUI x and y coordinates in variables GUIx and GUIy.
The gui elements turned out to be pretty easy to do, I could see them being used in some kind of Transistor-esque game where you pause it and see readouts on the different enemies.