Performance Testing In Unity

Last Updated : 6 May, 2026

Performance testing measures how your game behaves under different conditions. You test frame rate, memory usage, and load times on target devices.

  • Tests on real phones/computers (not just Editor).
  • Simulates heavy gameplay (many enemies, explosions).
  • Catches problems before players do.

Why Test on Real Device?

The Unity Editor runs faster than actual builds. What works in Editor may lag on phone.

In EditorOn Real Device
Uses PC powerUses phone CPU/GPU
No battery limitBattery drains
No heatingPhone may overheat
Fast storageSlower storage

Note: Always test on the low-end device you support.

Target Frame Rates

Set your target based on game type. Example:

C#
public class FPSTarget : MonoBehaviour
{
    void Start()
    {
        // Set target frame rate
        Application.targetFrameRate = 60;
        // Or for mobile
        Application.targetFrameRate = 30;
    }
}
  • Fast-paced shooter: 60 FPS (16.6 ms).
  • Casual/mobile: 30 FPS (33.3 ms).
  • Puzzle/strategy: 30 FPS (33.3 ms).

Test Scenario 1: Empty Scene

Establish your baseline. What to do:

  1. Build empty scene with just player and ground.
  2. Check FPS on target device.
  3. This is your maximum possible FPS.

If empty scene runs at 25 FPS on phone - problem with base settings (too high resolution, shadows, post-processing).

Test Scenario 2: Maximum Objects

Find your game's limit.

  1. Create a test scene with many enemies/bullets.
  2. Increase count until FPS drops below 30.
  3. This is your maximum spawn limit.

Example:

C#
public class StressTest : MonoBehaviour
{
    public GameObject enemyPrefab;
    [ContextMenu("Spawn 100 Enemies")]
    void Spawn100()
    {
        for (int i = 0; i < 100; i++)
        {
            Instantiate(enemyPrefab, Random.insideUnitSphere * 20, Quaternion.identity);
        }
        Debug.Log("100 enemies spawned - check FPS");
    }
    [ContextMenu("Spawn 500 Enemies")]
    void Spawn500()
    {
        for (int i = 0; i < 500; i++)
        {
            Instantiate(enemyPrefab, Random.insideUnitSphere * 20, Quaternion.identity);
        }
        Debug.Log("500 enemies spawned - check FPS");
    }
}

Right-click on script in Inspector - Spawn100 / Spawn500.

Test Scenario 3: Long Play Session

Some problems appear after minutes of play.

  1. Play for 30 minutes.
  2. Monitor FPS every 5 minutes.
  3. Watch for memory increase (leak).

Signs of problems:

  • FPS slowly decreasing over time.
  • Memory usage keeps growing.
  • Game becomes laggy after long play.

If FPS drops over time - memory leak or objects not being destroyed.

Check memory in Profiler: Take snapshot at start, another after 10 minutes. Compare.

Common Performance Test Results

ResultProblemFix
FPS drops with many enemiesToo many active objectsUse object pooling, reduce enemies
FPS drops with explosionsToo many particlesReduce particle count/lifetime
FPS drops over timeMemory leakCheck for unsubscribed events
Low FPS on low-end deviceGraphics too heavyLower texture size, disable shadows
Comment
Article Tags:

Explore