Storing Animation Clip in Animator Controller

Using uGUI, a button can generate an animator controller for transitions (normal, highlighted, pressed, disabled). In the project view, this controller has an arrow which, if expanded, shows the animation clips it contains.

My question is, if I create my own animator controllers, how can I create animation clips such that they are stored in the controller, just like the generated ones?

If I understood your question right, here are the steps:

Step 1) Select your GameObject that contains your “Animator controller” component in a Hierarchy view

Step 2 v1) If you already have animation clip => go to Animator view => right click (RMB) on the grid => create state => empty => select “New State” => add clip to the Motion

Step 2 v2) If you don’t have animation clip => go to Animation view => click here alt text => press “Create New Clip” name and save it somewhere within assets folders => press the red “record button” and start changing values in your object (read more detailed here) => now go to Animator view and it should already contain your new animation node

Step 3) Now assign transition from your new state node to the other ones by clicking on it and pressing right mouse (RMB) => Make Transition => select the other node to which you want to make transition.

P.S. Here is an updated answer to your question update:

Unfortunately as of now you can do that only via code and preferably in Editor or using [ExecuteInEditMode].

Without further hesitation here is the example code:

        // Get controller
        Object anim = AssetDatabase.LoadAssetAtPath("Assets/Something/SomeAnimator.controller", (typeof(Object)));
		// Add an animation clip to it
        AnimationClip animationClip = new AnimationClip();
		animationClip.name = "SomeClip";
		AssetDatabase.AddObjectToAsset(animationClip, anim);
		// Reimport the asset after adding an object.
		// Otherwise the change only shows up when saving the project
		AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(animationClip));