読者です 読者をやめる 読者になる 読者になる

Drawing wireframe of SkinnedMeshRenderer on Unity

f:id:peroon:20150930215405j:plain

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (SkinnedMeshRenderer))]
public class SkinWire : MonoBehaviour {

    public Color color;
    private SkinnedMeshRenderer smr;

    void Start () {
        smr = GetComponent<SkinnedMeshRenderer> ();
        smr.sharedMesh.SetIndices(smr.sharedMesh.GetIndices(0), MeshTopology.LineStrip, 0);

        smr.material.color = color;
    }

    // Return to default
    void OnApplicationQuit(){
        smr.sharedMesh.SetIndices(smr.sharedMesh.GetIndices(0), MeshTopology.Triangles, 0);
    }
}
  • Unlit shader and bloom is also match this wireframe view.