Version: 2022.2
public int relatedInstanceId ;

描述

Related instance ID of Unity Object.

Graphics resource might be related to the specific Unity Object such as Texture2D, RenderTexture. If relatedInstanceId isn't zero use FrameData.GetUnityObjectInfo to obtain further information about Unity Object.

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"; } } }