Version: 2022.1
언어: 한국어

Profiler.EmitSessionMetaData

매뉴얼로 전환
public static void EmitSessionMetaData (Guid id, int tag, Array data);
public static void EmitSessionMetaData (Guid id, int tag, List<T> data);
public static void EmitSessionMetaData (Guid id, int tag, NativeArray<T> data);

파라미터

id Unique identifier associated with the data.
tag Data stream index.
data Binary data.

설명

Write metadata associated with the whole Profiler session capture.

Use EmitSessionMetaData to write arbitrary binary data that should be available for all frames of this session. Data must contain only blittable types.

If the information you want to store in the Profiler meta data might change from frame to frame, consider using EmitFrameMetaData instead.

using System;
using System.Diagnostics;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Profiling;

public class Example { public struct TextureInfo { public int format; public int w; public int h; }

public static readonly Guid MyProjectId = new Guid("7E1DEA84-51F1-477A-82B5-B5C57AC1EBF7"); public static readonly int TextureInfoTag = 0; public static readonly int TextureDataTag = 1;

[Conditional("ENABLE_PROFILER")] public void EmitTextureToProfilerStream(Texture2D t) { if (!Profiler.enabled) return; TextureInfo textureInfo = new TextureInfo() { format = (int)t.format, w = t.width, h = t.height }; NativeArray<byte> textureData = t.GetRawTextureData<byte>(); Profiler.EmitSessionMetaData(MyProjectId, TextureInfoTag, new[] { textureInfo }); Profiler.EmitSessionMetaData(MyProjectId, TextureDataTag, textureData); } }

Note:
Writing large chunks of data might increase the Profiler's overhead and memory usage. Always check if Profiler is enabled before generating data. When possible, write data in small chunks to reduce memory usage.

See Also: FrameDataView.GetSessionMetaData.

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