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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by masterdz · Dec 06, 2013 at 11:20 AM · playeranimationsjoysticklayer

Problem with multiple animation Controlle Script

Hello guys,

I have problem when playing animatons when I press a joystick button, only the two first animations work, but the 2 last are not working

 if(Input.GetButtonDown("Fire1")){
          //    Instantiate(AttackEffect, transform.position, transform.rotation);
  //animation.Play("gogo_fire");
        // audio.PlayOneShot(AttackSound);
        
          _animation.CrossFade(Sword_Anim.name);
        
 walkSpeed = 1.0;
 trotSpeed = 1.0;
 }
 if(Input.GetButtonUp("Fire1")){
 walkSpeed = 14.0;
 trotSpeed = 16.0;
 }
 
     if(Input.GetButtonDown("Fire2")){
          //    Instantiate(AttackEffect, transform.position, transform.rotation);
  //animation.Play("gogo_fire");
       // audio.PlayOneShot(AttackSound);
        
          _animation.CrossFade(Sword_Anim2.name);
        
 }
         
     if(Input.GetButtonDown("Fire3")){
          //    Instantiate(AttackEffect, transform.position, transform.rotation);
  //animation.Play("gogo_fire");
      //  audio.PlayOneShot(AttackSound);
        
          _animation.CrossFade(Sword_Anim3.name);
         //animation.Blend("gogo_sword2");
        
 }
 
 if(Input.GetButtonDown("FireJoy")){
          //    Instantiate(AttackEffect, transform.position, transform.rotation);
  //animation.Play("gogo_fire");
       //  audio.PlayOneShot(AttackSound);
      
          _animation.CrossFade(Sword_Anim4.name);
 }
     

Please help :'(

Comment
Add comment · Show 3
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 GameVortex · Dec 06, 2013 at 12:13 PM 0
Share

Please format your code properly: Edit your question, mark everything that is code and hit the 101010 button next to the paperclip (attachment) button. =)

avatar image Stormizin · Dec 06, 2013 at 01:59 PM 0
Share

I edited your question.

avatar image masterdz · Dec 06, 2013 at 02:48 PM 0
Share

thank you so much guys, its the first time I post here :)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by masterdz · Dec 07, 2013 at 06:18 AM

help :'(

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
avatar image
0

Answer by GameVortex · Dec 07, 2013 at 08:43 AM

Okay, so what you are saying is that only "Fire1" and "Fire2" works, which plays Sword_Anim and Sword_Anim2 right?

There are a lot of things that can make this go wrong, so here is a little checklist:

1: Is the buttons "Fire3" and "FireJoy" hooked up to a joystick button and do they work at all? Go into: Edit - Project Settings - Input. And make sure the buttons are set up correctly. If they are then put a debug log in the script to print out if they are actually responding when pressing a button.

2: Are the animations Sword_Anim3 and Sword_Anim4 referenced in the editor inspector of this component? Go into the editor inspector of this gameobject and check if those two animations are referenced in the same way the two first animations are.

3: Also are the animations referenced in the Animation component itself? If the animation component does not have them it can not play them at all. Go into the inspector of the animation component and make sure they are referenced in the same way as the two first animations.

4: Does Sword_Anim3 and Sword_Anim4 actually have any keyframes and animation in them? Maybe they are actually playing but they have nothing to do in their animation. Check the import settings to make sure everything is alright. If they are made in unity, maybe they did not get saved properly?

5: If you are getting any errors or warnings or messages in the console, then include them with your question.

Comment
Add comment · Show 3 · 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 masterdz · Dec 07, 2013 at 09:59 AM 0
Share

Hello sir, you are right, but I checked every thing you said but all working good, because the animations working only on

 if(Input.GetButton("Fire3"))

and not on

 if(Input.GetButtonDown("Fire3"))

Weired!!!

avatar image masterdz · Dec 08, 2013 at 09:04 AM 0
Share

help please

avatar image GameVortex · Dec 08, 2013 at 09:20 AM 0
Share

I don't have much more ideas of what could be wrong. $$anonymous$$aybe you could either post the entire script you are using, or if you want you could zip up your project and add it to your question and I can take a look.

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

18 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

Related Questions

Network view not attached 0 Answers

Two gameObjects on collision one increase the health and the other decrease the health of the player. 2 Answers

Player moves faster when fps is higher? 1 Answer

Gate Question 1 Answer

Cant build game 3 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