Unity performance tips and checklist for beginner

  • Use Light backing.
  • For big scenes use manual light backing. Uncheck checkbox Auto.
  • Mark all static objects (that will never move on the scene) as Static in the Inspector window.
  • Turn On Dynamic and Static batching in the Build Settings…->Player Settings / Other settings.
  • In Light component use Culling mask property to exclude layers where we do not need lightning to hit.
  • Change the Resolution of the Shadow in Light component or Edit->Project Settings-> Quality for each platform.
  • Optimize using shadows. In Mesh Renderer component turn off Casting and Receiving shadows for all game objects which do not require shadows.
  • Use fake shadows whenever possible, simply draw them on the texture.
  • Use blob shadows as Projectors for moving objects.
  • Use Light Probes for dynamic objects.
  • Make sure we are generating additional set of UV coordinates for all static objects. Select model and in Import Settings/Model activate checkbox Generate Lightmap UVs. Click Apply.
  • For Reflection Probes choose wisely where to use backed and real-time reflection. For static objects use backed. Balance the quality of the reflection against performance gains or loses. Change resolution (for example to 128)
  • Remove unnecessary Rigid Bodies.
  • Do not store variables or do expensive operations in Update() method.
  • Comment all Debug.Log.
  • Use Object Pooling instead of Instantiate and Destroy.

 

 

 

 

 

3D Fps Graph Analyzer

3D Fps Graph Analyzer is a valuable component which allows to track the performance right in your app while you are wearing a Headset. It shows an accurate graph depending on the frame rate of a scene over period of time.

Currently it is available for HoloLens device and soon I’m going to add a support for Vive. For more details visit page – 3D Fps Graph Analyzer .

Downloadable from Unity Asset Store3D Fps Graph Analyzer (during re-submission process to the store the link may be not active)

How to test Unity app for Android platform in Emulator in Android Studio

(This was actual for unity version 5.5.1f1 and lower)

The steps below are only for the case when you are sure that you want to test your Unity application for Android platform directly in Android Studio in Emulator. For this:

  1. You need to export your application in Unity for Android platform – File/Build Settings… If you do not check “Export project” checkbox you will have “Build” button instead of “Export”.export
  2. Click “Export”.
  3. Start Android Studio. Make sure that you already have everything set up – Android SDK and JAVA_HOME variable.
  4. In Android Studio choose “Open an existing Android Studio project” then navigate to the just exported project folder.
  5. Shift+10 or Run, choose Emulator (you can also choose your Device).

In most cases you would not need to test your application like this. You will just work in Unity, “Build” the app for Android platform in Build Settings window and then test created *.apk file on any Android device clicking “Play” in Unity Editor. . For this you will need to have Unity Remote app installed on the Android device.

Setting up Unity Remote to test on the device from Unity:

  1. Download Unity Remote app in Play Store for Android device
  2. Connect your device to PC using USB cable
  3. In Unity go to Edit->Project Settings-> Editor and select Any device.
  4. Restart Unity so it will pick up Unity Remote.
  5. Click “Play” in Unity.