I have a big problem on unity for 1 month, I created a simple 2D mobile game, in my game I have a cube moving continously, the player just touch the screen to make the cube jump, is the only action he can do.
My problem come at every interaction, each time the user hit the screen (the bug is only on mobile) I have a stutter lag, drop fps
At first I was thinking the problem was cause by my jump with physics or somethings else because when the player hit the screen the cube jump. My cube is moving in fixedUpdate with changing velocity and he’s jumping with addForce (2d rigidbody)
But in my game I have an automatic bumper and when the cube hit one, he’s jumping perfectly smooth. SoI thought the problem come frome my Input.GetKey(KeyCode.Mouse0) moreover on my main menu I just hit the screen on a simple canvas and I have the same fps problem, so I don’t know if therre is something with raycast or eventSystem going wrong but I tried a lot of things to fix and no one work.
I precise I try to build my mobile game on 3 different phone :
Samsung S10e / lag a little bit but don’t ruin game experience
Iphone 5s / lag a lot and ruin the game experience
Iphone 14 Pro / lag a lot and ruin the game experience
Thanks for reading and hope someone can help me !