How to generate or create a non existing script (preferably C#)?
It is always time consuming and tiring for me to create the methods for my object's animations.
So I am planning to create a custom Editor where I can just refer the GameObject with Animation component, enter a name for the script to be generated then click a button to automatically generate a C# script with methods that plays the animations of that object.
I was wondering if there's a way to make a string and assign the code needed to that string then turn it into a C# script.
I have read on AssetDatabase and Monoscript about create an Asset but still no luck.
There's no problem with attaching the generated script to a GameObject.
Thank you.
[Update]
Additional Information

So based to this component, I want to generate a C# script that has the methods of playing each animation like this..
using UnityEngine;
using System.Collections;
public class Level3TerrainB : MonoBehaviour {
private string animationPrefix = "arm_Root_PlatformB|anim_";
public void AnimatePressButtonA() {
animation.Blend (animationPrefix + "PressButtonA");
}
public void AnimateUnpressButtonA() {
animation.Blend (animationPrefix + "UnpressButtonA");
}
public void AnimatePressButtonB() {
animation.Blend (animationPrefix + "PressButtonB");
}
public void AnimateUnpressButtonB() {
animation.Blend (animationPrefix + "UnpressButtonB");
}
public void AnimateUpButtonB() {
animation.Blend (animationPrefix + "UpButtonB");
}
public void AnimateDownButtonB() {
animation.Blend (animationPrefix + "DownButtonB");
}
public void AnimatePressButtonC() {
animation.Blend (animationPrefix + "PressButtonC");
}
public void AnimateUnpressButtonC() {
animation.Blend (animationPrefix + "UnpressButtonC");
}
public void AnimateUpButtonC() {
animation.Blend (animationPrefix + "UpButtonC");
}
public void AnimateDownButtonC() {
animation.Blend (animationPrefix + "DownButtonC");
}
public void AnimatePressButtonD() {
animation.Blend (animationPrefix + "PressButtonD");
}
public void AnimateUnpressButtonD() {
animation.Blend (animationPrefix + "UnpressButtonD");
}
public void AnimateLeftUpPulleyA() {
animation.Blend (animationPrefix + "LeftUpPulleyA");
}
public void AnimateRightUpPulleyA() {
animation.Blend (animationPrefix + "RightUpPulleyA");
}
public void AnimateLeftUpPulleyB() {
animation.Blend (animationPrefix + "LeftUpPulleyB");
}
public void AnimateRightUpPulleyB() {
animation.Blend (animationPrefix + "RightUpPulleyB");
}
}
I don't want to hard code it again, and again.. because I have many other levels to animate to.
Monobehaviorscript. May I know how or what kind of a mini plugin?