Created
July 15, 2020 12:08
-
-
Save phi-lira/4fc6e6c4fb996d25edbd60437f51c9e2 to your computer and use it in GitHub Desktop.
How to profile build time for a Unity project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Enable Profiler in OnPreprocessBuild like following: | |
public void OnPreprocessBuild(BuildReport report) | |
{ | |
Profiler.enabled = true; | |
Profiler.enableBinaryLog = true; | |
Profiler.logFile = "profilerlog.raw"; | |
Debug.Log("Enabling Profiler"); | |
} | |
2) Disable Profiler in OnPostProcessBuild | |
3) Now put Profiler.Begin/EndSample in the desired code. | |
4) Build project. This will save a profile data into profilerlog.raw file in your project folder. | |
5) Now open Profiler window and load the the .raw file by clicking on the load binary button in the toolbar. | |
6) Make sure to disable `Collapse Editor Only samples` to view editor samples in detail. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment