- Home /
Draw Particles over Text (GUIText or GUI.Label)
Hi!
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! :)
Answer by Eric5h5 · Jun 07, 2010 at 05:11 PM
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.
there's some step by step tutorial for that? I have the same problem!
Answer by Tetrad · Jun 07, 2010 at 04:17 PM
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.
Cool, that works, thanks! The 3D text was more blurry than a regular GUIText though, so I might go for the multiple-camera answer ins$$anonymous$$d if I'm not able to fix the more blurry text.
Another solution would be to import a higher-res font (in the import settings change the font size) if that's what's causing your blurryness.
Also please be sure to mark the question as "answered".
Thanks, I tried that, but it still wasn't as clear as 100% GUIText or GUI.Label... :(
Answer by jonas-echterhoff · Jun 07, 2010 at 10:51 PM
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.