- Home /
3-D Text Visible Through my Level
Hey guys, new to Unity - but I've read up on the basics, etc.
I want to put up a sign to a business in my 3-d world (on a building out in front of it), but when I run the game I can see the 3-D text through walls and wherever I'm at in the world. How do I fix this? It's got be an easy fix.
Use a text mesh or a texture with text on it. GUI displays text as 2d, not 3d.
The fact that people are expected to engage in a multi-step procedure implementing a community-made custom shader just to get around this behavior is, frankly, ridiculous. This is something that should be in Unity to begin with.
Answer by testure · Jun 25, 2011 at 12:24 AM
3DText ignores depth- you'll need to use a different shader that takes z-depth into consideration:
http://forum.unity3d.com/threads/9931-3D-text-that-takes-the-depth-buffer-into-account
I can see this is heading in the right direction as that person Eric says to "$$anonymous$$ake a new GUI/Text Shader that's a copy of the built-in one, but with "ZTest Always" removed, and use that." but how do I even find the file that contains the shader to make a copy of it?
i don't understand what you don't understand.. you just pasted the instructions- they're clear as glass.
I guess what I'm asking is how do I do this : "Place this shader somewhere in your Assets folder hierarchy. Then, replace the font material on the mesh renderer of the 3D text with a different material that uses this shader (and the appropriate font texture of course—this won't work for the built-in font because the font texture for that is not available). Also make sure the 3DText object is using the same font that was used to generate the font texture. "
@ Testure
lol are you serious? It's not clear at all to someone who doesn't know how to attach a shader to a material - as well as duplicate a font material to do so.
I made a shader - I made a material - but I need the material to be the font material that allows the custom font to be visible.
Answer by Waz · Jun 27, 2011 at 05:08 AM
This is answered here: http://answers.unity3d.com/questions/12576/3d-text-rendering-over-scene-objetcs.html
Answer by Pan_Migo · Dec 03, 2016 at 07:39 AM
Because you say you need a sign you could you a go to GameObject -> UI -> Text. Then if you switch the canvas to world space you will be able to see this 2d text in your 3d scene. The solution i provide does not use 3d text but i assume it solves the problem for you.
Answer by jrat · Oct 11, 2015 at 06:37 PM
Make sure the walls have materials with "Transparent/Diffuse" shaders.
I was having the same problem, with text showing through a Quad. I then changed the shader on the Quad, and the text stopped showing through. Hope this works!
Answer by lockay · Nov 20, 2015 at 08:13 AM
I made a script so that the Mesh Renderer is de-activated if the player is a certain distance away from the object. #pragma strict
var player : Transform;
var thing : GameObject;
var viewDist : float;
var comp : Component;
function Update () {
if(Vector3.Distance(player.position, thing.transform.position) > viewDist){
thing.GetComponent(MeshRenderer).enabled = false;
} else {
thing.GetComponent(MeshRenderer).enabled = true;
}
}
Then attach the script to the text, and drag your player into the "Player" spot and the 3D Text into the "Thing" spot. Finally, set the viewDist variable to the distance you want the text to be visible from.
Your answer
![](https://koobas.hobune.stream/wayback/20220612120321im_/https://answers.unity.com/themes/thub/images/avi.jpg)