docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MetadataCollect

    Abstract class for creating a metadata collector type to populate the PackedMemorySnapshot.Metadata member. You can add multiple collectors, but it is recommended to add only one. A collector instance will auto-register during construction.

    Inheritance
    object
    MetadataCollect
    Namespace: Unity.MemoryProfiler
    Assembly: Unity.MemoryProfiler.dll
    Syntax
    public abstract class MetadataCollect
    Remarks

    Creating a collector instance will override the default metadata collection functionality. If you want to keep the default metadata, go to the DefaultCollect method in the file com.unity.memoryprofiler\Runtime\MetadataInjector.cs and copy that code into your collector method. Removing a collector can be achieved by calling dispose on the collector instance you want to unregister.

    Constructors

    MetadataCollect()

    Default constructor of the MetadataCollect.

    Declaration
    protected MetadataCollect()
    Examples
    public class MyMetadataCollect : MetadataCollect
    {
        public MyMetadataCollect() : base()
        {
        }
    
        public CollectMetadata(MetaData data)
        {
            // Metadata which is added by default.
            data.content = $"Project name: { Application.productName }";
            data.platform = string.Empty;
        }
    }

    Methods

    CollectMetadata(MemorySnapshotMetadata)

    The Memory Profiler will invoke this method during the capture process, to populate the metadata of the capture.

    Declaration
    public abstract void CollectMetadata(MemorySnapshotMetadata data)
    Parameters
    Type Name Description
    MemorySnapshotMetadata data

    The data payload that will get written to the snapshot file.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)