Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Conect11 · Jan 27, 2014 at 04:49 AM · animationambiguous reference

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 :)

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': UnityEngine.Animation.Play(UnityEngine.AnimationPlayMode), UnityEngine.Animation.Play(UnityEngine.PlayMode).

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)
 {
      
      animation.Play(1);
        
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
        Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
        Halt();
        }
        }
        
        function Halt() 
        {
        if(Vector3.Distance(myTransform.position, target.position) < stopDistance)
        moveSpeed = 0;
        
             else{
                 moveSpeed = 1;
        animation.Play(2); 
        }
        
        
        
        
        
        
        
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GameVortex · Jan 27, 2014 at 09:10 AM

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:

Casting:

 animation.Play((PlayMode)1);

Specify:

 animation.Play(PlayMode.StopAll);
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animation problems 1 Answer

Can the animation editor create local rotational data? 3 Answers

Adding animation clips via script 2 Answers

Can I make animations snap to a frame? 1 Answer

So many script problems. Please help, urgent! 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges