Block Breaker Building to different Android Devices Stuttering Issue

block-breaker

#1

Hello,

I was testing the performance of the Block Breaker game on different Android devices. It runs buttery smooth on my laptop and my OnePlus 3T android device, but it has terrible stuttering in my Galaxy Tab A and Galaxy J7. Please help me understand how I can fix the issue. I have tried the following fixes:

  1. Turning on Interpolate on Rigidbody 2D of the Ball gameobject.

  2. Setting the ball velocity inside FixedUpdate()

    private void FixedUpdate()
    {
    myRigidBody2D.velocity = myRigidBody2D.velocity.normalized * ballSpeed;
    }

  3. Using Time.deltaTime for motion of both Paddle and Ball.

  4. Changing fixedDeltaTime to 0.005.

Please note that I had initially designed the game in (1920x1080) 16:9 aspect ratio and using the following function to Scale the Camera on different devices:
public void ScreenAdjust()
{
Camera.main.aspect = 1920f / 1080f;
}
Could this be the reason for stuttering? If yes, what could be the possible solution?


#2

Hi Tanya,

Unfortunately, developing games for mobile platforms is not part of this course, and neither is performance optimisation.

Your OnePlus 3T has got much more RAM (6 GB) and is faster (2.35 GHz) than your Galaxy Tab A (2 GB, 1.6 GHz).

The first thing I would do is to set the fixedDeltaTime back to the initial value. Then I would open the Profiler in Unity and look for potential problems. You could start with setting the Quality Settings to the lowest possible option, test the build on your slowest device.

Instead of instantiating new AudioSources with AudioSource.PlayClipAtPoint, you could attach an AudioSource to your camera and play them whenever a block is supposed to make a sound.


See also: