How to nest Animation file in an Animation Controller?

44058-screenshot-2015-04-07-141730.png

When I click auto generate animation for uGUI I get this animation controller which I think is nice because it keeps the animation file it uses in places.

I wanted to do this for my own animation controller as well. How can I do that? Because just dragging animation file into controller file does not work.

That is probably done using the AssetDatabase - specifically, AssetDatabase.AddObjectToAsset. Remember that if you nest assets like that, you’ll have to import the asset again before you can see the changes in the inspector - use AssetDatabase.ImportAsset to do that.