Shaded Wireframe Script
Posted by Adam on 29 December 2021 at 12:07 pm
As I work through reacquiring the knowledge I once had, I'll be frequently posting creations and discoveries. That way, not only can I refer back, but also I'll be documenting my progress.
The first snippet is simply to enable wireframes for a camera object. Create a ShadedWireframe
script, and assign it to the camera object:
using UnityEngine;
public class ShadedWireframe : MonoBehaviour
{
[SerializeField] private bool wireframe = true;
void OnPreRender()
{
if (wireframe) GL.wireframe = true;
}
void OnPostRender()
{
if (wireframe) GL.wireframe = false;
}
}