How to save the Animation Blend Tree created by script?

In my project, I create the AnimatorController by script. Everything seems well, but the blend tree disappears each time I restart Unity and I need to recreate the AnimatorController again! The animation just shows “no motion”. Does anyone knows how to solve the problem?

Anyone can help ??? OTZ

Anyone can help ???

Finally I solved the problem with the help of a colleague.
Blend tree created by script will not be serialized without doing this:


Just use AssetDatabase.AddObjectToAsset to add your blend tree to the animator controller and everything will goes well!

2 Likes

Thank you!

Thank you!.

Hey i did some digging and loaded all objects under .controller, the blendtrees are actually saved there but are somehow hidden, the notion saving blendtrees is a bad idea, its saved but hidden just like the solution you used up there, the question now is how do i save a nested asset and make it invisible, blendtrees docking underneath the .controller file is an eye sore, Help here… :slight_smile:

1 Like

Thank you!