Making a character's idle animation loop. (model and animation created in blender)

I’ve tried everything that i can come up with. My game is almost finished it just need proper animations and i’m done. I made my model (made in blender, rigged in blender, animated in blender.) i make a animation controller and my idle animation does in fact work BUT it only plays once. I went to the animation and looked at it in the inspector tab and there is clearly a loop button but nothing in the menu is clickable (it is grayed out and does not respond to my attempts to click. Ive also tried exporting it as a FBX and doing the same process. NO LUCK. if you could please help me that would be great.

Hey there,

Alright, so firstly when you import a model and animations from blender to unity, the “prefab” that you first drag into the scene view should not be used as your final player. The reason being that you cannot adjust the values of the initial components on it. Also if the character is deleted from the scene, you will have to set him up again.

Instead, add all of the additional components you want to add to it, then create a NEW prefab of it. This will allow you to adjust the animation settings etc, while the original imported gameobject is preserved in case you need to change it later on. This way, you can also add as many characters as you want to the scene.

As for controlling your animations, it is best to do this through script so that you have more control over them.

For example:

using UnityEngine;
using System.Collections;

public class AnimationControl : MonoBehaviour {

	void Start () {
		//Set the wrapmode for each animation
		animation["Idle"].wrapMode = WrapMode.Loop;
		animation["Run"].wrapMode = WrapMode.Loop;
		animation["Jump"].wrapMode = WrapMode.Once;
		//Stop all animations from playing in case we forgot to do this in the inspector
		animation.Stop();
	}
	
	void Update () {
		//Play the run animation if vertical is pressed
		if(Input.GetButton("Vertical")) {
			animation.CrossFade("run", 0.2f);	
		}
		else if(Input.GetButtonDown("Jump")) {
			animation.CrossFade("Jump", 0.2f);	
		}
		else {
			animation.CrossFade("Idle", 0.2f);	
		}
	}
}

Note that this code is untested and may require some tweaking to get it to work correctly.

Good Luck.