Forked from karljj1/Unity Assembly Definition Debugger.cs
Created
September 11, 2018 15:05
-
-
Save Novack/2e0e2e4c72ce04d8f4366f9b0796f46f to your computer and use it in GitHub Desktop.
Find out what assemblies are being built and how long each takes.
This file contains hidden or 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
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using UnityEditor; | |
| using UnityEditor.Compilation; | |
| [InitializeOnLoad] | |
| public class AsmdefDebug | |
| { | |
| static Dictionary<string, Stopwatch> s_Assemblies = new Dictionary<string, Stopwatch>(); | |
| static AsmdefDebug() | |
| { | |
| UnityEngine.Debug.Log("Setting up"); | |
| CompilationPipeline.assemblyCompilationStarted += CompilationPipelineOnAssemblyCompilationStarted; | |
| CompilationPipeline.assemblyCompilationFinished += CompilationPipelineOnAssemblyCompilationFinished; | |
| } | |
| static void CompilationPipelineOnAssemblyCompilationStarted(string obj) | |
| { | |
| var sw = new Stopwatch(); | |
| s_Assemblies[obj] = sw; | |
| sw.Start(); | |
| } | |
| static void CompilationPipelineOnAssemblyCompilationFinished(string arg1, CompilerMessage[] arg2) | |
| { | |
| var sw = s_Assemblies[arg1]; | |
| sw.Stop(); | |
| UnityEngine.Debug.Log(arg1 + "\nTime:" + sw.Elapsed.ToString()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment