using System; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class SerializableBone { public string Name = ""; public string ParentName = ""; public List Tags = new List(); public SerializableTransform Transform = new SerializableTransform(); /// Reference to original bone for runtime. Not saved to file. [NonSerialized] public Transform Bone; public SerializableBone(){} public SerializableBone(Transform t, bool generateTags = true, List tags = null) { if(tags == null) tags = new List(); if (generateTags) { if (t.name.EndsWith("_L")) { tags.Add(BoneTags.Left); } else if (t.name.EndsWith("_R")) { tags.Add(BoneTags.Right); } } Name = t.name; Tags = tags; Transform = new SerializableTransform(t, Space.Self); ParentName = t.parent == null ? "root" : t.parent.name; Bone = t; } //feel free to add more. do not change order! public enum BoneTags { Left, Right, Dynamic, Humanoid, Finger, Face, IK, } }