Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Animation scripting problem!

$
0
0
using UnityEngine; using System.Collections; public class EnemyAnimation : MonoBehaviour { Animation _animation; void Start() { _animation = GetComponentInChildren(); 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'

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>