Animation Lag

I know this isn’t a question for the animator window but its still an animation question.
Using Unity 5.3.4

This is lagging more though due to video recording it. The lag I’m really getting is just a jerk for a hair of a second. But still though why? My game is crazy light weight too as for animation going on.

First I tried this idea.

void Update() {

   if(ConsoleMove) {

      if(!ConsoleDirection) {

         ConsoleWindow.Translate(Vector3.left * Time.deltaTime * ConsoleMoveSpeedSetting, Space.Self);

         if (ConsoleWindow.localPosition.x < ConsoleMoveStopSetting) {

            ConsoleMove = false;
             
         }

}else{

   ConsoleWindow.Translate(Vector3.right * Time.deltaTime * ConsoleMoveSpeedSetting, Space.Self);

   if (ConsoleWindow.localPosition.x > ConsoleStartPosition) {

      ConsoleMove = false;
            

   }
}
}

}

Then for kicks I tried Itween. I know this isn’t using their api that works with the Update function.

public void CollapseConsole(Toggle toggle) {

   Hashtable positionHashs = newHashtable();

   if(!toggle.isOn) {

      positionHashs["from"] = newVector2(-253.2f,0f);

      positionHashs["to"] = newVector2(-556f,0f);

   }else{

      positionHashs["from"] = newVector2(-556f,0f);

      positionHashs["to"] = newVector2(-253.2f,0f);

   }

   positionHashs["time"] = .8f;

   positionHashs["onupdate"] = "UpateConsolePositions";

   iTween.ValueTo(gameObject, positionHashs);

}

void UpateConsolePositions(Vector2 newVector2){

   ConsoleWindow.localPosition = newVector2;

}

Apparently this lag goes away when doing a build. So its just when playing it in the editor.

1 Like