oh man, why did you use string for animation definition when you have AnimationClip?
public AnimationClip IdleAnimation;
public float IdleAnimationLayer=0;
public float IdleAnimationSpeed=1;
public WrapMode IdleAnimationWrapMode = WrapMode.Loop;
public AudioClip IdleSound;
-----> later on when you want to play animation :
if (IdleAnimation !=null)
{
animation[IdleAnimation.name].layer = IdleAnimationLayer;
animation[IdleAnimation.name].speed = IdleAnimationSpeed;
animation[IdleAnimation.name].wrapMode = IdleAnimationWrapMode;
animation.CrossFade(IdleAnimation.name, IdleAnimationFade);
}
if (IdleSound != null)
audio.PlayOneShot(IdleSound);
this way you give developers all flexibility possible, and instead of writing animation names you simply drag and drop them so why not?







This has been talked about in the live chat a few times. I am doing this off the top of my head on the fly. SInce I had the Animation component already attached, I just referenced the animation by calling it by name. You can also use the animation clip if you want.
It will be updated when we revisit it.