Loop Time through Script 2D 4.3

I am attempting to create animations through a script, since many of my characters will follow the same 2d Spritesheets. So far I have been able to construct the animation clip, but I am unable to check the “loop time” box through script. This loop time can be seen in the inspector of an animation clip, and is by default checked when used the mechanim.

I have used tried the wrapmode, but this has no effect.

Heres my code so far:

EditorCurveBinding curveBinding = new EditorCurveBinding();

	// I want to change the sprites of the sprite renderer, so I put the typeof(SpriteRenderer) as the binding type.
	
	curveBinding.type = typeof(SpriteRenderer);
	
	// Regular path to the gameobject that will be changed (empty string means root)
	
	curveBinding.path = "";
	
	// This is the property name to change the sprite of a sprite renderer
	
	curveBinding.propertyName = "m_Sprite";
	
	
	
	// An array to hold the object keyframes
	
	ObjectReferenceKeyframe[] keyFrames = new ObjectReferenceKeyframe[6];
	
	
	
	for (int i = 0; i < 6; i++)
		
	{
		
		keyFrames *= new ObjectReferenceKeyframe();*
  •   	// set the time*
    

_ keyFrames*.time = timeForKey(i);*_

* // set reference for the sprite you want*

_ keyFrames*.value = spriteForKey(i);
Debug.Log(keyFrames.time + " frame: " + keyFrames.value);*_

* }*

* AnimationUtility.SetAnimationType(animClip, ModelImporterAnimationType.Generic);*
* AnimationUtility.SetObjectReferenceCurve(animClip, curveBinding, keyFrames);*
* animClip.wrapMode = WrapMode.Loop;*
* AssetDatabase.CreateAsset(animClip, “Assets/Animations/testing/MyAnim.anim”);*
* AssetDatabase.SaveAssets();*
Is there some simple call to access the loop time/ loop pose boolean?

After working on this error for sometime and talking in the scripting forums, it appears you are not able to currently access the loop time variable. It resides in the animationclipsettings object, but you can not access the set method.

To help anyone who is building multiple animations through scripting, the fastest way to handle the loop time boolean is to select all created animations (using shift and ctrl), go to the inspector, right click the inspector tab, select debug, and check the loop time box. You must go do debug to select loop time for multiple objects.