Skip to content

Instantly share code, notes, and snippets.

@gekidoslair
Created April 13, 2020 23:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gekidoslair/b08ef1910fbf354283be81c139a5796b to your computer and use it in GitHub Desktop.
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
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