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
Im guessing without reading that its an issue of the State $$anonymous$$achine not playing nicely. Open the Animator and observe your Transitions and Anim ticker.
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
You can read the state of the parameter with
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.
Thanks $$anonymous$$eat I will try that that will probably work. Thanks!
Your answer
Follow this Question
Related Questions
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
Objects with animation/animator is not showing up in Android Build 3 Answers
Broken animations in Unity 5.3.5f 1 Answer