- Home /
Why does my animation jump/lag when activating a game object?
I am trying to move a game object and its children off screen while simultaneously moving a newly initialized object onto the screen using this co-routine:
public IEnumerator FromPacksToLevels (){
GameController.Screens.LevelSelect.SetActive (true);
IEnumerator TOUT = GameController.Screens.PackSelect.GetComponent<LoadPacks> ().TransitionR2L ();
IEnumerator TIN = GameController.Screens.LevelSelect.GetComponent<LoadLevels> ().TransitionR2L ();
StartCoroutine (TOUT);
StartCoroutine (TIN);
yield return new WaitForSeconds(0.55f);
GameController.Screens.PackSelect.SetActive (false);
}
The transitions (TransitionR2L) look like this:
public IEnumerator TransitionR2L(){
IEnumerator Slide = BasicAnimations.RelativeMove (gameObject, slideLeft, .5f);
StartCoroutine (Slide);
yield return null;
}
This works ok, but there is a noticeable lag/jump in the animation the first time that it runs. Successive transitions are smooth (if I go back and forth between levels and packs) but the first one is not.
Is there something I need to do or check to see if an object and its children are fully initialized before initiating the transition animation?
Your answer
![](https://koobas.hobune.stream/wayback/20220612035348im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Animation clip skipping keyframes when FPS drop? 0 Answers
Reduce Lag When Loading Multiple Animations 0 Answers
Mesh.CreateVBO function in Android 0 Answers
Fade in & out Activation Tracks in Timeline 2 Answers
Stutter/Lag while animating 2 Answers