Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by MacroArcade · Oct 21, 2015 at 09:09 AM · animationsscript erroranimationclipanimation.playmissingmethodexception

My Animation Only Play Once? (Noob)

First One Excuse My English And This Is My Email To Contact Me macroarcadeyt@gmail.com

My Animation Only Play One Time I put a script for animate it I put my 3D model in legacy with all animations in the script and in the "animation" (not in the animator) and it supose to make idle animation and then walk in circles but it only make the idle animation and it do it only one time why this? :/ :( Im desesperated pls answer me PD I See a tutorial to make the script and in the tutorial function it perfectly, I use it in two diferent version of unity and it make the same error and I use like 3 or 4 diferent scripts :/

this is the error that appear in the console

 MissingMethodException: UnityEngine.Animation.play
 Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
 Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
 Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
 Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
 Boo.Lang.Runtime.RuntimeServices+c__AnonStorey15.<>m__9 ()
 Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
 UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)
 IA.Nada () (at Assets/IA/IA.js:78)
 IA.Update () (at Assets/IA/IA.js:51)

And this is the script:

 //Estado var Estado : int = 0;
 
 //Animaciones
 
 var nada : AnimationClip;
 
 var caminar : AnimationClip;
 
 var correr : AnimationClip;
 
 var atacar : AnimationClip;
 
 var morir : AnimationClip;
 
 //Valores
 
 var pat : float= 0; var patu : boolean= true;
 
 
 function Start () {
 
 }
 
 function Update () {
 
     if (pat < 0){
         patu= false;
         estado= 0;
     }
 
     if (pat > 10){
         patu= true;
         estado= 1;
     }
 
     if (patu == true){
 
         pat -= 1 *Time.deltaTime;
     }
 
     if (patu == false){
 
         pat += 1 *Time.deltaTime;
     }
 
     if (Estado == 0){//nada
         Nada ();
     }
 
     if (Estado == 1){//patrullar
         Patrullar ();
     }
 
     if (Estado == 2){//perseguir
         Perseguir ();
     }
 
     if (Estado == 3){//atacar
         Atacar ();
     }
 
     if (Estado == 4){//morir
         Morir ();
     }
 
     if (Estado == 5){//esquivar
         Esquivar ();
     } }
 
 
 function Nada () {
 
     GetComponent.<Animation>().play (nada.name);
 
 }
 
 function Patrullar () {
 
     transform.Rotate (Vector3 (0,120,0)*Time.deltaTime);
 
     transform.Translate (Vector3 (0,0,1)*Time.deltaTime);
 
     GetComponent.<Animation>().play (caminar.name);
 
 }
 
 function Perseguir () {
 
     GetComponent.<Animation>().play (correr.name);
 
 }
 
 function Atacar () {
 
     GetComponent.<Animation>().play (atacar.name);
 
 }
 
 function Morir () {
 
     GetComponent.<Animation>().play (morir.name); }
 
 function Esquivar () {
 
     GetComponent.<Animation>().play (correr.name);
 
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Statement · Oct 21, 2015 at 05:41 PM

Looks like the problem is that you are calling Animation.play which doesn't exist. Animation.Play exists though. Upper and lower case are important.

If you turn on type safe compilation with #pragma strict you can catch these errors early. Also you had a typo with estado and Estado.

See if it works with those fixes.

 #pragma strict
 
 //Estado 
 
 var Estado : int = 0;
 
 //Animaciones
 
 var nada : AnimationClip;
 var caminar : AnimationClip;
 var correr : AnimationClip;
 var atacar : AnimationClip;
 var morir : AnimationClip;
  
 //Valores
  
 var pat : float= 0; 
 var patu : boolean= true;
 
 function Update()
 {
     if (pat < 0)
     {
         patu = false;
         Estado = 0;
     }
 
     if (pat > 10)
     {
         patu = true;
         Estado = 1;
     }
 
     if (patu == true)
     {
         pat -= 1 * Time.deltaTime;
     }
 
     if (patu == false)
     {
         pat += 1 * Time.deltaTime;
     }
 
     if (Estado == 0)
     {
         Nada();
     }
 
     if (Estado == 1)
     {
         Patrullar();
     }
 
     if (Estado == 2)
     {
         Perseguir();
     }
 
     if (Estado == 3)
     {
         Atacar();
     }
 
     if (Estado == 4)
     {
         Morir();
     }
 
     if (Estado == 5)
     {
         Esquivar();
     }
 }
 
 function Nada()
 {
     GetComponent.< Animation > ().Play(nada.name);
 }
 
 function Patrullar()
 {
     transform.Rotate(Vector3(0, 120, 0) * Time.deltaTime);
     transform.Translate(Vector3(0, 0, 1) * Time.deltaTime);
     GetComponent.< Animation > ().Play(caminar.name);
 }
 
 function Perseguir()
 {
     GetComponent.< Animation > ().Play(correr.name);
 }
 
 function Atacar()
 {
     GetComponent.< Animation > ().Play(atacar.name);
 }
 
 function Morir()
 {
     GetComponent.< Animation > ().Play(morir.name);
 }
 
 function Esquivar()
 {
     GetComponent.< Animation > ().Play(correr.name);
 }
Comment
Add comment · Show 1 · 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
avatar image MacroArcade · Oct 21, 2015 at 06:17 PM 0
Share

Thanks It Function I $$anonymous$$ade A Lot Of Error With De Upper Case Letter In $$anonymous$$y Codes And Animation.Play jeje Thanks @Statement And Thanks @Guidanel :D

avatar image
1

Answer by GiyomuGames · Oct 21, 2015 at 09:19 AM

If you click on your animation object in your Project view you should be able to set it to loop from the inspector. Regarding your code, you should learn about "else if" and "switch". It will improve the quality of your code.

Comment
Add comment · Show 1 · 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
avatar image MacroArcade · Oct 22, 2015 at 08:18 AM 0
Share

@Guidanel

Ok He Loop The Animation Thanks For Help $$anonymous$$e With That But Now He Only Use Idle, the script is like don't use the ping-pong method to make it patrol you know why this? this is a screenshot of all the inspector:

Page 1 $$anonymous$$odel: https://gyazo.com/930da271f8de996d538d4a7a3ddf0e36

Page 2 $$anonymous$$odel: https://gyazo.com/0ef40c5aee688b6cc3626fde92f3eac4

Rig: https://gyazo.com/dba68d3d2172b6d7e06d3df1957bb45c

Page 1 Animation: https://gyazo.com/544c17b8c456eda1f198e284a3b92e9c

Page 2 Animation: https://gyazo.com/abf6cbba722c961369eac3b4420c3dd2

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Onde encontro a pasta "projet's assets"? 0 Answers

JSON to .anim file 0 Answers

On button down animation plays 1 Answer

Animations Not Working 0 Answers

animations don't work after set to Legacy 0 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