x


A Prefab with animation.Play doesnt work

Hi, I made a simple model using maya and exported as a FBX. It basically had two sets of animation , one is a walk sequence and the other a hit sequence. I made this model an enemy prefab, so that I could instantiate it, and set all the animation parameters in unity with an animation script attached. The problem is, if I drag and drop the original fbx model in the inspector, attach the same animation script and run the game the animations, both walk and hit, play correctly. But if I drag and drop the enemyPrefab the animation doest seem to work.I have searched but I have not found an answer. Can you please help me with it. I apolozise if this has been asked before. I have tried with Crossfade and Play with the prefab but to no avail.

script c#:

if (Vector3.Distance(objPlayer.transform.position,objEnemy.transform.position)<10.0f) { objEnemy.animation.Play("eHit"); } else { objEnemy.animation.Play("eWalk"); }

Cheers wolfhammer

more ▼

asked Mar 22 '11 at 06:29 AM

wolfhammer gravatar image

wolfhammer
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3936
x1288
x575
x406

asked: Mar 22 '11 at 06:29 AM

Seen: 1206 times

Last Updated: Mar 22 '11 at 06:29 AM