Use layers. Change the layer of the game object (drop-down list in the upper right corner of the Inspector window) from Default to another layer (you can create a new one by selecting Add Layer ... from the drop-down menu).
Then create a new camera (or select the main camera, depending on what you want to achieve), and change your Culling Mask to the layer that you use in the game object.
To draw the wireframe, you put this script in the camera, which should draw this game object:
// from http://docs.unity3d.com/ScriptReference/GL-wireframe.html using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnPreRender() { GL.wireframe = true; } void OnPostRender() { GL.wireframe = false; } }
You may have to use 2 cameras depending on what you want to achieve (one camera for a wireframe object, another camera for drawing the rest of the scene), in which case you would set the "Clear flags" checkboxes of one of the cameras not to clear. Make sure the depth value for both cameras is the same.
The βClearβ flags of the camera indicate what will happen to the pixels, where there is nothing that could be drawn (empty space) of this camera, and also what happens when several cameras draw the same pixel.
In the case when Clear Flags does not clear, it will not do anything with empty space, leaving it for another camera to fill with an object or background. For pixels, where he needs to draw something, he will allow the depth of the object to decide what will be drawn, that is, objects that are closer to the camera will be drawn on top of the others.
source share