- Home /
UI Animation Not Playing
I've been trying to figure this out for a long time now. I have an animation that plays just fin the first time round. I deactivate the canvas panel with the associated animation in order to show an other panel. But when I reactivate my Laser Charge animation panel what happens is it plays the sound effect just fine, but my animation does not play, it just shows the final state of the animation (Last frame) So I'm not sure what I'm doing wrong??
//animator reference
private Animator animLaserUp;
void Start () {
//unpause the game on start
//Time.timeScale = 1;
//get the animator component
animLaserUp = LaserChargeAni.GetComponent<Animator>();
//disable it on start to stop it from playing the default animation
animLaserUp.enabled = false;
//anim.enabled = true;
//DontDestroyOnLoad(this.gameObject);
}
public void LaserNoise1()
{
SFXmanager SFXl = FindObjectOfType<SFXmanager> ();
SFXl.PlayLaserChargingSFX ();
}
public void StartLaserCharge(){
StartCoroutine(LaserCharge());
}
IEnumerator LaserCharge(){
yield return new WaitForSeconds (0.9f); // wait time
LaserChargeAni.SetActive (true);
animLaserUp.enabled = true;
SFXmanager SFXl = FindObjectOfType<SFXmanager> ();
SFXl.PlayLaserChargingSFX ();
animLaserUp.Play("LaserChargeUpAni");
yield return new WaitForSeconds (5.0f); // wait time
animLaserUp.enabled = false;
LaserChargeAni.SetActive (false);
//MainPanel.SetActive (true);
//Return to main screen
//CameraSwitcher cs1 = FindObjectOfType<CameraSwitcher>();
//cs1.EnableCamera1();
LaserScopeScreenManager LSCM = FindObjectOfType<LaserScopeScreenManager>();
LSCM.LaserCamStart ();
LaserScopePanel.SetActive(true);
masterPanelManagerObject.LaserScopePanelActive = true;
yield return new WaitForSeconds (0.2f); // wait time
LaserChargePanel.SetActive (false);
}
Comment
Answer by Eddieg0226 · May 02, 2019 at 06:31 PM
Make sure you set the Update Mode of your animator to Unscaled Time if you want to play animations while your game is paused.
Stupid. I just made the same mistake. Thanks for the response! XD