• 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
Question by Azbo · Feb 16, 2016 at 02:42 PM · animationandroidanimator

How to load animation quicker/Make animation more responsive

Hello fellow programmers! This is my first question on the forums so I hope I can get the most out of it!

Just recently I released my fist app on Android and it is coming to iOS soon:

https://play.google.com/store/apps/details?id=com.opticodesoftware.galacticrain

(Please give me feedback it is my first game!)

Anyways, lots of people had a bit of problems controlling the shield. I think it is just a problem with how responsive the sheild is on different devices. To play just hold the sheild goes up let go it goes down and you want to deflect the fireballs. So the shield for people when it got to the top would not go down and when it was down at the bottom it would not go up right away. (it will take like 5 seconds).

Script: By the way it uses Event triggers for the buttons so that is why the buttons are in public void methods. using UnityEngine; using System.Collections;

 public class AnimateSheildScript : MonoBehaviour {
 
     public GameObject other;  
     public GameObject other1; 
     public Animator animator; 
     public Animation reverseAnim; 
     public GameObject button; 
 
     public void animationstuff(){
         //Play Animation 
         Debug.Log ("Screen tapped"); 
         other.SetActive (true); 
         other1.SetActive (false); 
     }
 
     public void animationStop(){
         Debug.Log ("Finger Lifted"); 
         animator.speed = -1;
         button.SetActive (true); 
         //if its playing set button active
     }
 
     public void animationswitch(){
         animator.speed = 1; 
     }
 
     public void animationswitch2(){
         animator.speed = -1; 
     }
 }    

Thank you for all help!!

Cheers, Ryan/Opticode Software

Comment

People who like this

0 Show 1
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 meat5000 · Feb 16, 2016 at 03:40 PM 0
Share

Im guessing without reading that its an issue of the State Machine not playing nicely. Open the Animator and observe your Transitions and Anim ticker.

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by meat5000 · Feb 19, 2016 at 11:26 AM

Open the relevant controller file for your animations.

Add a Parameter. Make it a Boolean one.

Duplicate the single animation state so you have two identical states with the same animation in each. Make one speed = 1 and the other speed = -1.

Make transitions back and forth between them and clicking on each transition arrow add in the boolean parameter as a condition.

You control the parameter from script with

Animator.SetBool.

You can read the state of the parameter with

GetBool

If animations are still playing to the end instead of being interrupted look at your exit times (and atomic in older versions of Unity).

Clicking on animation transitions look at the blue slider bar with its little marker arrows. This controls the amount of time that 2 animations spend transitioning from one to the other. Put them close together to make it snappy.

Comment

People who like this

0 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 Azbo · Feb 20, 2016 at 03:46 PM 0
Share

Thanks Meat I will try that that will probably work. Thanks!

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Objects with animation/animator is not showing up in Android Build 3 Answers

Camera child to animated object does not work 1 Answer

Apk on android does not start. Reason: Animator | Не запускается Apk на андройд. Причина: Animator 0 Answers

Animator not working on android (script generated animation clip) 0 Answers

HELP,Watched tutorial https://www.youtube.com/watch?v=Xnyb2f6Qqzg 1 Answer


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