Mobile game work on Android but is lagging on IOS

Hi everyone !

I’m making a 2D mobile game and I have a problem that I can’t resolved, the mobile game is working perfectly on editor but when i build my game on mobile (only on IOS phone) my caracter is laggy when I clic the screen to jump.

I have a little cube who constantly move sometime to the right sometime to the left, my jump need to be a continuous jump so I use Input.GetKey this allow the cube to jump everytime his ground whith the first screen clic.

So this is how i do to move and jump my cube :

    private void Update()
    {
        if (Input.GetKey(KeyCode.Mouse0) && isGrounded)
        {
             jumpForce = 22f;
             letsJump = true;
        }
    }
    private void FixedUpdate()
    {
        if (letsJump)
        {
            cubeRB.velocity = new Vector2(0, 0);

            // I tryed with velocity jump and velocity move
            cubeRB.velocity = cubeRB.velocity + Vector2.up * jumpForce;

            // And I tryed with AddForce jump and AddForce move, also a mix of them
            //cubeRB.AddForce(transform.up * jumpForce, ForceMode2D.Impulse);

            letsJump = false;
        }
        if (canMove)
        {
            // Velocity move
            cubeRB.velocity = new Vector2(speed * direction * Time.deltaTime, cubeRB.velocity.y);

            // AddForce move
            //cubeRB.AddForce((new Vector2(direction, cubeRB.velocity.y) - cubeRB.velocity)
               * speed * Time.fixedDeltaTime);
        }
    }

I have search a lot of things and tryed to find a solution but none works.

I tryed :
Application.targetFrameRate = 60;
And
Vsync count → Don’t sync in project settings
And
Fixed Timestep default with 0.02 and try to reduce at 0.01 and 0.005

I have follow this for optimize my game performances :

But the problem still persist…

Here a short video for better comprehension of my problem :

Notice this doesn’t happen on every jump, when I tap the screen once I don’t get lag most of the time, it’s usually when I keep tapping the screen that it does.

And As you can see in the video there is automatic jump with purple bumper using the same jump method (turn letsJump to true with highter jumpForce) and for this I don’t touch the screen and the jump is perfectly fluid.

On the video it’s looking smooth but when I play it’s very embarassing

Image of performance on Iphone after I jump severals time the game get 60 fps and can drop to 50/40 fps when i jump.

It’s working perfectly on Samsung S10e and It’s lagging on Iphone 14 Pro

Any kind of help will be greatly appreciated.

Using 2021.3.2f1

I’m not sure if it’s related to your problem but I think you should change Time.deltatime to Time.fixedDeltaTime on line 27

Thanks for your reply, I tried changing deltaTime with fixedDeltaTime and the bug is still there, but I tried adding fixedDeltaTime to the jump with velocity on line 17. Now it’s really better it lags a bit on some jump but not all. I noticed on the hud performance graph that the blue curve is not stable and the bug occurs each time there is a wave on this curve (when I click on the screen) I don’t know what means Pre (curve name) and what might affect it