docs.unity3d.com
    Show / Hide Table of Contents

    Measure.Custom()

    When you want to record samples outside of frame time, method time, or profiler markers, use a custom measurement. It can be any value.

    Example: Use a custom measurement to capture total allocated memory

    [Test, Performance]
    public void Test()
    {
        SampleGroup sampleGroup = new SampleGroup("TotalAllocatedMemory", SampleUnit.Megabyte, false);
        var allocatedMemory = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong() / 1048576f;
        Measure.Custom(sampleGroup, allocatedMemory);
    }
    
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023