Should I use UnityGUI or TextMesh for in-game dialogue bubbles?

I’m creating a 2D side-scroller in Unity 4.3, and I’d like have the main character, and NPCs, say things via a chat bubble by their sprite. As the character or npc moves, the chat bubble should follow them.

I’m wondering about best practice here. Would I use UnityGUI to do this? Or, would I use a TextMesh component (for text) with some additional coding for the variable-sized background (chat bubble graphic)? I’m wondering since typically I see GUI functionality used on static graphics that lay “on top of” the actual game, and not for graphics “inside” the action of the game.

You have three choices of text, GUI, GUIText, and 3D Text/TextMesh (without going to third-party tools). All three will appear on top of all other game objects by default. With a bit of work, you can make 3D Text appear in the ‘Z’ order of your objects:

Since you want the text to follow the character, 3D Text would be easiest to implement. GUIText lives in viewport space, so you would need to do a Camera.WorldToViewportPoint() to get it to position correctly. GUI text is even more difficult to position. You would have to do a Camera.WorldToScreenPoint(), convert the resulting position to a GUI coordinate, then probably recalculate position to move the anchor to the middle.