- Home /
Animation scripting problem!
using UnityEngine;
using System.Collections;
public class EnemyAnimation : MonoBehaviour
{
Animation _animation;
void Start()
{
_animation = GetComponentInChildren<Animation>();
int animToPlay;
string animationToPlay = "";
switch (Random.Range(0, 3))
{
default:
case 0:
animationToPlay = "Move1";
animToPlay = 1;
break;
case 1:
animationToPlay = "Move2";
animToPlay = 2;
break;
case 2:
animationToPlay = "Move3";
animToPlay = 3;
break;
}
_animation[animToPlay].wrapMode = WrapMode.Loop;
_animation.Play(animationToPlay);
_animation[animToPlay].normalizedTime = Random.value;
}
}
Hi guys above is my code, i having problem at the _animation[animToPlay].normalizedTime = Random.value; it says error cs1503:Argument #1 cannot convert 'int' expression to type 'string'
Comment
Your answer
Follow this Question
Related Questions
Set Animation priority 1 Answer
Can the animation editor create local rotational data? 3 Answers
Animation not playing completely 1 Answer
Adding animation clips via script 2 Answers
Setting animation files' wrapmode 0 Answers