Unity Game Optimization
上QQ阅读APP看书,第一时间看更新

Editor or standalone instances

In this instance, the only way to access the Profiler is to launch it through the Unity Editor and connect it to a running instance of our application. We will use the same Profiler windows irrespective of whether we execute our game in Playmode within the Editor, running a standalone application on the local or remote device, or wish to profile the Editor itself.

To open Profiler, navigate to Window | Analysis Profiler within the Editor or use Ctrl + 7 (or cmd + 7 on macOS):

If the Editor is already running in Playmode, then we should see profiling data continuously populating the Profiler window.

To profile standalone projects, ensure that the Development Build and Autoconnect Profiler flags are enabled when the application is built.

Choosing whether to profile an Editor-based instance (through the Editor's Playmode) or a standalone instance (built and running separately from the Editor) can be achieved through the Connected Player option in the Profiler window:

Note that switching back to the Unity Editor while profiling a separate standalone project will halt all data collection since the application will not be updated while it is in the background.