Version: 2021.3
LanguageEnglish
  • C#

FrameDataView.GetMarkerMetadataInfo

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public MarkerMetadataInfo[] GetMarkerMetadataInfo(int markerId);

Parameters

markerId Marker identifier.

Returns

MarkerMetadataInfo[] Returns an array of metadata information structures.

Description

Gets Profiler marker metadata information for the specific marker identifier.

Use to get name, unit type and value type for the metadata parameters which can be passed together with a Profiler sample associated with the identifier.

using System.Text;
using UnityEditor.Profiling;

public class Example { public static string GetFormattedMetadata(HierarchyFrameDataView frameDataView, int itemId, int mergedSampleIndex) { int sampleMetadataCount = frameDataView.GetItemMergedSamplesMetadataCount(itemId, mergedSampleIndex); if (sampleMetadataCount == 0) return null;

var metadataInfo = frameDataView.GetMarkerMetadataInfo(frameDataView.GetItemMarkerID(itemId)); var sb = new StringBuilder(); for (var i = 0; i < sampleMetadataCount; ++i) { if (metadataInfo != null && i < metadataInfo.Length) sb.Append(metadataInfo[i].name); else sb.Append(i); sb.Append(": "); sb.Append(frameDataView.GetItemMergedSamplesMetadata(itemId, mergedSampleIndex, i)); sb.Append('\n'); }

return sb.ToString(); } }

Throws:
System.ArgumentException if markerId is invalid.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961