problem with text

I am trying to add a text to a gameobject.
If i try to add text as a component in gameobject text doesnt show. If i add text as a gameobject it goes in the canvas object, If i move it to other gameobject, text again doesnt show.
Can any1 tell me why this isnt working

You want to add the 3D Text component; that component adds text to the 3D scene, whereas GUI Text objects aren’t part of the 3D scene.

The tricky thing though is that the shader on 3D Text actually displays through other objects! I’ve been meaning to try my hand at writing a convenient text shader, but in the meantime there’s this kinda complicated-to-setup option:
http://wiki.unity3d.com/index.php?title=3DText

Well, there is another option: you can make a little Canvas embedded in your GameObject. If you set the scale, size, and draw mode appropriately, this becomes a convenient way to draw text or other UI elements associated with an object, such as stats or a health bar.

Does it matter if every entity in the game has a separate Canvas? I don’t know what the performance considerations are for Canvas.

You mean i would need to make a seperate canvas for every object that i want a text on top of it

Yeah, that’s what I mean — if you want to use the new UI stuff, but have the text appear in the 3D world and move around with your character, then this is (as far as I know) the only way to do it.

I don’t have any way to know for sure, but I suspect the performance cost of this is minimal. Canvas is basically just a different way of computing the transformations applied to objects they contain, to get from local coordinates to screen coordinates. Whether there’s a Canvas in the chain or not, in the end it’s just a bunch of matrix multiplies. I could be wrong, of course, but I’ve used this technique a few times and certainly didn’t notice any problems.