- Home /
[Android]My game freezes for 2-3 seconds after i move my character for the first time
Like the title says, my game freezes for 2-3 seconds after i move my character for the first time, it doesn't freeze when i'm in unity and i'm trying to run the game, but when i put it on a mobile device it does freeze for the amount of seconds stated in the title. Can someone shed some light upon this issue? Is it because I have to much stuff in the start method? Here's the start method: Is it the FindObjectOfType method that slows things down?
void Start () {
myRigidBody = GetComponent<Rigidbody2D> ();
jumpBehaviour = GameObject.FindObjectOfType<JumpButtonBehaviour> ();
dir = 0f;
moveVelocity = 1;
anim = GetComponent<Animator> ();
dontIgnore = true;
nextCombo = 0f;
firstAttackUsed = false;
isAttacking = false;
isJumping = false;
canMove = true;
}
What happens (disregarding the resulting errors) if you comment out the line with FindObjectOfType?
i tried it after and it still freezes, shouldn't it freeze when the game actually starts if it were a start method problem? i'm asking this because my game freezes when i first move the character. when the level starts all the monsters move without problems, but when i first move my character, that's when it freezes, it freezes for 1-2 seconds, i kinda exagerated when i said 2-3 seconds. Nonetheless it's really annoying.
Your answer
![](https://koobas.hobune.stream/wayback/20220612032755im_/https://answers.unity.com/themes/thub/images/avi.jpg)