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 Sirmaiji · Sep 01, 2013 at 02:00 PM · animationbuttonanimategetbutton

Animation Issue

Let's say we've got a simple script:

 if
   (Input.GetButton ("Aiming") && Input.GetButton ("Action")){
   animation.CrossFade("shoot");   
 }


But if I let "Action" button up almost immediately or trying to press the button very fast the animation clip doesn't play till the very end. Is there any solution to make animation play it's full length, so that the next action (button press) will be available only after animation's finished? Thanks in advance for your help :)

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
0

Answer by Sirmaiji · Sep 01, 2013 at 05:42 PM

The animation is not playing. Using this code leads to disabling "shoot" animation at all.

Comment
Add comment · Show 2 · 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 Sajidfarooq · Sep 01, 2013 at 06:57 PM 0
Share

Did you copy-paste my code or retype it? Try copy-pasting. I think you missed the "!" before animation.IsPlaying...

avatar image SudoSandwich · Sep 01, 2013 at 09:06 PM 0
Share

I was on a cell phone didn't see your post :) I use that for $$anonymous$$e without the '!' I deleted my comment as it was irrelevant given your answer was saying the same thing.

avatar image
0

Answer by KuPAfoo · Sep 01, 2013 at 06:58 PM

your recognizing both the aim button and the fire button to cause the shoot animation.

to test this remove the aiming portion of the if statement

run code

use fire button

if you can fire successfully, make a nested if statement

(if"aiming") { show crosshair (if"action") {play"shoot"}//end ifaction }//end if aiming

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 Sirmaiji · Sep 02, 2013 at 03:33 PM 0
Share

Guess somehow I've found the way out. Here's what may be helpfull for those who might have the same issue:

     if
           (Input.GetAxis ("Vertical") < 0.0 && (Input.GetButton ("Action")) && (Input.GetButton ("Ai$$anonymous$$g"))){
           animation.CrossFade ("shoot_down");
           animation["shoot"].normalizedTime = 0.5;}
     else {  
     
     if
           (Input.GetAxis ("Vertical") > 0.0 && (Input.GetButton ("Action")) && (Input.GetButton ("Ai$$anonymous$$g"))){
           animation.CrossFade ("shoot_up");
           animation["shoot"].normalizedTime = 0.5;}
     else {
     
     if      
           (Input.GetButton("Ai$$anonymous$$g")){
           
     if
           (Input.GetButton("Action")){
           animation.CrossFade("shoot");
           animation["shoot_up"].normalizedTime = 0.5;
           animation["shoot_down"].normalizedTime = 0.5;}}

But still got an issue with just "shoot" (forward) action. I can't add animation["shoot"]"normalizedTime" to "shoot" animation neither to "Ai$$anonymous$$g" input, nor to "Action" (last 5 code lines). The thing is, when those two buttons pressed all the animation being stuck. I guess the problem's in contradiction between variables "animation.CrossFade("shoot")" and animation["shoot"]"normalizedTime". Still wanna find out how to solve that...

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

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

Related Questions

Loop animation on button hold 2 Answers

Crazy weird input script order glitch please help! 1 Answer

Animation can't find my animations 1 Answer

GetButton Problem 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 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