Ambigous Reference Animation

Hello everyone,

I’ve learned some valuable lessons today. Chief among them: If you’re going to build to Android, do so from the very beginning of your project, lest you end up like me and have over 110 shiny brand new compiler errors when you go to make your build :slight_smile:

So, I’m happy to report that through the grace of God, and doing a lot of Googling I’ve been able to whittle these errors down to 5. These last few have me stumped, even with searching and finding some answers. I have the following: (all five errors are the same, in different places, so just posting one)

Assets/Standard Assets
(Mobile)/Scripts/AI.js(26,20): // (also line 41 - added by OP)
BCE0004: Ambiguous reference ‘Play’:

I’ve seen the same error in search results, but never pertaining to animations. Am hoping someone can point out what I’m doing wrong. Thanks, and God bless.

var target : Transform;
var moveSpeed = 1;
var rotationSpeed = 2;
var myTransform : Transform;
var minDistance = 30;
var stopDistance = 1;
function Awake()
myTransform = transform;
function Start()
target = GameObject.FindWithTag("Player").transform;
function Update () {
     if(Vector3.Distance(myTransform.position, target.position) < minDistance)
       myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
       Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
       myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
       function Halt() 
       if(Vector3.Distance(myTransform.position, target.position) < stopDistance)
       moveSpeed = 0;
				moveSpeed = 1;

As it says, it is an ambiguous reference on line 26 and 41 between the functions .Play(UnityEngine.AnimationPlayMode) and .Play(UnityEngine.PlayMode). Those two functions require different types of Enums. You are using an int to specify the enum, but the compiler does not know which enum you mean. Therefore it does not know which function to use.

So either cast the int to the correct enum or specify the enum directly: