Draw Particles over Text (GUIText or GUI.Label)


Is there any way to draw a particle effect, using e.g. ParticleSystem, to draw it over text drawn using either GUIText or GUI.Label?

I need to move a particle effect over a text the user selects, and need to draw it over the text as it looks kind of strange being drawn behind the text...

Or perhaps someway of turning text into a texture, and drawing it as a normal gameobject behind the particles or something?

Thanks! :)

You have to use more than one camera: put the particle system on a layer of its own, which is drawn by a camera that only shows that layer, and has clear flags set to depth only. This camera should have a higher depth so it draws on top of the camera that has the GUIText, and the particle system camera shouldn't have a GUILayer component. This will only work with GUIText/GUITexture and not OnGUI functions, which seem to be drawn on top of everything regardless. There's an answer around somewhere which explains the camera setup in more detail if you need that.

I don't think there is a way to do specifically what you ask for (although I haven't tried the render to texture approach personally), but you could do it by making your text out of a text mesh. You'll have to use a different shader for your text mesh material so it gets sorted properly instead of drawn on top of everything always. There's an example of one here.

Instead of GUIText or GUI.Label, use the TextMesh component (GameObject->Create->3d Text). That gives you a text mesh, which you can freely place in your 3d world.