Create animation clip without "using UnityEditor"

Hi . In my 2D game I create the animations for many characters from their atlases using this code in my script . But I can’t use UnityEditor in Build so I must find another way to do it . So far I haven’t found a way . Please help !

using UnityEditor;

void createRunAnim(){
		EditorCurveBinding curveBinding = new EditorCurveBinding();
		curveBinding.type = typeof(SpriteRenderer);
		curveBinding.path = "";
		curveBinding.propertyName = "m_Sprite";
		
		ObjectReferenceKeyframe[] runFrames = new ObjectReferenceKeyframe[6];
		for(int i=3 ; i<= 8; i++){
			runFrames[i-3] = new ObjectReferenceKeyframe();
			runFrames[i-3].value = animalArray*;*
  •  	runFrames[i-3].time = (i-3);*
    
  •  }*
    
  •  AnimationUtility.SetObjectReferenceCurve(run,curveBinding,runFrames);*
    
  • }*

But you are creating the animation at runtime? If you are just creating them in editor and then using them, just save them at some point and create a reference to the animation to be used in game.