Version: 2023.1

GfxResourceInfo

struct in UnityEditor.Profiling

切换到手册

描述

Provides methods for retrieving graphics resource information.

using UnityEditorInternal;
using UnityEditor.Profiling;

public class Example { public static string GetGfxResourceName(int frame, ulong gfxResourceId) { using (var frameData = ProfilerDriver.GetRawFrameDataView(frame, 0)) { if (frameData.GetGfxResourceInfo(gfxResourceId, out var info)) { if (frameData.GetUnityObjectInfo(info.relatedInstanceId, out var objectInfo)) return objectInfo.name; } return "N/A"; } } }

变量

relatedAllocationRootIdRelated native allocation id of the graphics resource.
relatedInstanceIdRelated instance ID of Unity Object.