Easily measure your code with this library
- Make sure you have at least Unity 2017.4.10f1 (previous versions weren't tested).
See our wiki for documentation.
using System;
using TP.Measurement; // import this namespace to use the library
public class TestScript : TPTestScript
{
// Return all Action you want to automatically measure
protected override Action[] GetActionsToMeasure()
{
return new Action[] {
Void, // Void is empty method from TPTestScript
// ()=> { MyMethod(); },
()=> { bool isUntagged = gameObject.tag == "Untagged"; },
()=> { bool isUntagged = gameObject.CompareTag("Untagged"); },
()=> { bool isUntagged = gameObject.tag.Equals("Untagged"); }
};
}
// Calls after Unity's Start method
protected override void OnStarted()
{
MeasureAverageRepeat(); // automatically measures all action from GetActionsToMeasure()
TPMeasure.Measure("My custom measure", () => { /* code */ }).ShowLog();
}
// Code in this section will be showed in Unity's profiler
protected override void UpdateProfile()
{
// code
}
private void MyMethod()
{
// code
}
}
You can freely contribute with us by reporting issues and making pull requests!
Please read CONTRIBUTING.md for details on contributing.
- Tomasz Piowczyk - The Creator
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.