Skip to content

Instantly share code, notes, and snippets.

@jorik041
Forked from gekidoslair/BoneDebug.cs
Created April 14, 2020 11:31
Show Gist options
  • Save jorik041/9eeecba7e8ac9262239b4a9c94615c8d to your computer and use it in GitHub Desktop.
Save jorik041/9eeecba7e8ac9262239b4a9c94615c8d 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
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