Created
April 13, 2020 23:00
-
-
Save gekidoslair/b08ef1910fbf354283be81c139a5796b to your computer and use it in GitHub Desktop.
Simple tool that displays all of the bones that a particular mesh is bound to - useful for debugging skin weighting etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[ExecuteInEditMode] | |
public class BoneDebug : MonoBehaviour | |
{ | |
SkinnedMeshRenderer skm; | |
public List<Transform> bones = new List<Transform>(); | |
public void OnEnable() | |
{ | |
Init(); | |
} | |
[ContextMenu("Refresh Bone Debug")] | |
public void Init() | |
{ | |
skm = GetComponent<SkinnedMeshRenderer>(); | |
if (skm != null) | |
{ | |
var boneList = skm.bones; | |
foreach (var bone in boneList) | |
{ | |
bones.Add(bone); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment