- Home /
See mesh through all other meshes
Hi all,
I have a pretty simple task: I want to make it so that one of my gameobjects that has a mesh is visible through all other meshes. e.g. If the player is looking at a wall, and the gameobject is behind the wall, the player can still see it. Is there any simple way to do this? I was thinking along the lines of something with multiple cameras rendering at different depths (wall being at one depth and object being at another), but I'm new to Unity so I'm not sure exactly how to approach this.
Thanks for any help!
Answer by ajkolenc · Jul 18, 2014 at 12:43 AM
I think your first instinct was the same as mine; in Unity you can set a camera's "culling mask" so that it only renders objects on a particular layer. You can have two cameras at the same position; one that renders only your object's layer, and another that renders the rest of the layers. Then it's just a matter of setting the depth of the first camera to a higher value than the depth of the second, and switching the "clear flags" of the first camera to "Depth Only" (so that the background doesn't render over the rest of your geometry).
How do I set my objects layer though?
EDIT: Ah I see Culling $$anonymous$$ask and Layer are the same thing.
You can set a game object's layer in the inspector at the top right-hand corner.
Your answer
Follow this Question
Related Questions
[CLOSED] First Person Controller's Mesh Renderer 0 Answers
Apply colors to a mesh with a splatMap 0 Answers
Generating too many blocks crashes the game (Both exe and in editor) 2 Answers
How to toggle Mesh Render Enabled from Parent animation time? 0 Answers
[SOLVED] Combining 2 textures into one 2 Answers