- Home /
Help!, Android plataform SCRIPT?
Hey guys, i have a Script Of animations to Play, works perfectly when the Target Plataform is PC, but, when i switch to Android, Give this error: Assets/Scripts/Player/PlayerAnimControl.js(25,28): BCE0019: 'isPlaying' is not a member of 'UnityEngine.AnimationState'.
Here is my Script:
var idle : AnimationClip;
var run : AnimationClip;
var flip : AnimationClip;
var death : AnimationClip;
function Start () {
animation["flip"].layer = 2;
animation.Play("idle");
}
function OnGUI () {
if(PlayerControl.Start==false){
animation.Play("idle");
}
if(PlayerControl.Start==true){
animation.Play("run");
}
if (GUI.Button(Rect(10,100,50,50),"Jump"))
animation.CrossFade ("flip");
else if(!animation["flip"].isPlaying)
animation.CrossFade ("run");
}
any help will be awesome, thank you guys
Answer by pako · Mar 15, 2014 at 11:55 AM
In line 25 the function animation["flip"] returns an AnimationState object which doesn't have a member "isPlaying", and you get the error. See:
http://docs.unity3d.com/Documentation/ScriptReference/Animation.Index_operator.html
You must change line 25 to the following:
else if(!animation.IsPlaying("flip"))
Notice the capital "i" in IsPlaying. This is different from when you use Animation.isPlaying (with a lower case "i") to check if ANY animation is playing. A very subtle difference.
See also:
http://docs.unity3d.com/Documentation/ScriptReference/Animation.IsPlaying.html
Your answer
