docs.unity.cn
    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
    Syntax
    public abstract class MetadataCollect : IDisposable
    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(MetaData)

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

    Declaration
    public abstract void CollectMetadata(MetaData data)
    Parameters
    Type Name Description
    UnityEngine.Profiling.Memory.Experimental.MetaData data

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

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Monday, May 8, 2023