2d Sprite Animation Editor Scripting.

Hi,
I am doing a 2d game which has more than 100 animation using sprites or Image animation. It has 36 small scenes and every scene will have atleast 4-5 animation. I was a cocos2d-x developer and migrated to Unity3d. Every time i have to make an animation i am dragging and dropping images in Animation panel.

Lets Assume i have a 24 image animation & i am adding a keyframe after every 5 miliseconds & picking images from a folder Texture/Car. This work is boring, monotonous and Could be easily done with Editor script. As all the variables are known. I just dont know how to look or access all this editor variables and generate animation clip.

Now what i want is if i am trying to make an animation on the image then i should be able to attach an editor script to it and give it source image folder address so that it can take all the images and give it miliseconds difference for each key frame addition. And it should save the animation clip on target folder with the specified name.

If someone could even direct me with the terms and terminology or basic editor script then i can modify it according to my need as this will save my 50 % of time which i can do for other things.

Thanks

@jugnu nope! I actually removed my answer because I realized it wasn’t what you were asking.

You’ll of course have some validation and such based on how you’re working, but the basic steps are something like:

  1. Create a new AnimationClip
  2. Get or create the EditorCurveBinding for your SpriteRenderer’s m_Sprite property
  3. Use UnityEditor.AnimationUtility.SetObjectReferenceCurve() to set your sprite sequence on the clip using the binding you created in step 2 and the clip created in step 1
  4. Save your AnimationClip in the project (using e.g., AssetDatabase.CreateAsset() with your new clip created in step 1)