How to play character animation after bone deparent?

For a certain reason, I want to take apart a character’s bones separately(a bone will have no parent and no child).

However, before an animation is advanced, bone structure is needed to be restored.

So referred to Unity execution order ( ), my code is like this.

void Update()

//animations are advanced...

void LateUpdate()
	//execute some process


void ParentBone()
	child.parent = parent;

void DeparentBone()
	child.parent = null;

But the animation isn’t played. Where do I make mistakes? How can I separate bones and play character’s animation?

I can’t really remember if this should work (it depends on when animation tracks are rebound to transforms).

You could do this by having secondary skeleton (which is deparented) and then you would copy desired world-pose transforms from parented (invisible, but animated) skeleton.

The constant parenting and deparenting may end up being a huge hit to performance – not necessarily, but I’d stress test that early on, just to be careful. The basic issue with animations not playing is likely due to the base Animation component’s references being invalidated. It’s sort of a fragile component with respect to hierarchy changes.

In any case, flattening the hierarchy is NOT going to help you with your scale->skew issues, so don’t waste your time on it. I’ll explain in more detail on that question.