Unity Performance Test

Terence Tsang
2 min readMay 30, 2019

--

Nothing is faster than the speed of light

Readings

What it can achieve

  • Integrate with Unit Testing
  • Record FPS, Ram, Draw call, etc
  • Integrate with Profiler, where you can get the execution time of individual element

How to enable Performance Test

  • Open /YourProject/Packages/manifest.json
  • add the following
{
"dependencies": {
...
},
"testables": [
"com.unity.test-framework.performance"
]
  • Create a new folder Assets/Tests
  • Create an assembly definition
  • Check the box “Test Assemblies” and select “Unity.PerformanceTesting” in the Assembly Definition References. Select “Any Platform”
  • Create a test script: Create > Testing > C# Test Script
  • Open Window > General > Test Runner
  • Open Window > Analysis > Performance Test Report

Test Script

Please not Profiler data can only goes for it’s own named scope. For example, you cannot measure the “PlayerLocal” of two different scope of codes, try to create two different test cases for such purpose.

Sample Result

--

--