I’ve been calling AnimationRiggingEditorUtils.BoneRendererSetup()
from an editor script to init a bone renderer on an rigged object added to the scene, which is really helpful for visualization. However, when upgrading to 2020.2 from 20201., I now get an error that this method is protected and can’t be called. Is there some other way I can achieve this still without having to manually go to the menu and select that option from the list for every object I add to the scene with my editor tool?
I am also using the bonerenderer, I think it should be made part of unity itself, cause it’s very useful.
I add the component at runtime and init it like this:
if (ShowBones)
{
UnityEngine.Animations.Rigging.BoneRenderer boneRenderer = ReferenceSkin.rootBone.gameObject.AddComponent<UnityEngine.Animations.Rigging.BoneRenderer>();
boneRenderer.transforms = SkinnedMeshCombiner.GetAllHumanoidBones(animator);
}
SkinnedMeshCombiner is my custom class to combine skinnedmeshes. Below the code of the method above.
public static Transform[] GetAllHumanoidBones(Animator _animator)
{
if (_animator == null) return null;
List<Transform> HumanBones=new List<Transform>();
foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones)))
{
if (bone != HumanBodyBones.LastBone)
{
HumanBones.Add(_animator.GetBoneTransform(bone));
}
}
return HumanBones.ToArray();
}
Not using 2020.2 yet, so don’t know if the code above works anymore.