Debug.Log Extensions
Documentation (1.1.9)

◆ StartSubStopwatch() [2/3]

static void Debug.StartSubStopwatch ( [NotNull] string  name)
static

Starts a new sub-stopwatch running under the stopwatch that was last started using StartStopwatch.

The sub-stopwatch will continue running until FinishSubStopwatch(string) is called with the same name.

If no stopwatches are currently running a warning will be logged and no sub-stopwatch will be started.

void Start()
{
// Prints:
// LoadLevel : Test . . . 14.672 s
// Environment . . . 9.671 s
// Terrain . . . 0.669 s
// Trees . . . 1.999 s
// Vegetation . . . 3 s
// Actors . . . 5 s
LoadLevel("Test");
}
void LoadLevel(string sceneName)
{
Debug.StartStopwatch($"{nameof(LoadLevel)} : {sceneName}");
SceneManager.LoadScene(sceneName);
Load(LoadEnvironment);
Load(LoadActors);
}
void LoadEnvironment()
{
Load(LoadTerrain); <br>
Load(LoadTrees);
Load(LoadVegetation);
}
void Load(Action operation)
{
Debug.StartSubStopwatch(operation.Method.Name);
operation();
}
static void StartSubStopwatch()
Starts a new sub-stopwatch running under the stopwatch that was last started using StartStopwatch.
Definition: Debug.cs:5230
static void FinishSubStopwatch()
Gets the last started stopwatch and finishes the sub-stopwatch inside it which was last started,...
Definition: Debug.cs:5427
static void FinishStopwatch()
Logs results of the last created stopwatch and clears it.
Definition: Debug.cs:5492
static void StartStopwatch()
Starts a new stopwatch counting upwards from zero.
Definition: Debug.cs:5117
Extended version of the built-in Debug class with additional methods to ease debugging while developi...
Definition: Debug.cs:34
Parameters
nameThe label for the timer.