Version: 2022.3
言語: 日本語
public bool GetUnityObjectInfo (int instanceId, out Profiling.FrameDataView.UnityObjectInfo info);

パラメーター

instanceId UnityEngine.Object instance identifier.
info UnityEngine.Object information output struct with name and other attributes.

戻り値

bool Returns true if instanceId exists in the frame and object information is available.

説明

Gets the UnityEngine.Object information for a given Instance ID.

Obtains information about the UnityEngine.Object instance in the profiler capture.

The Profiler sample can be associated with an instance of an object instance that represents an Asset, a GameObject, or anything that is derived from UnityEngine.Object.
This information is available as a part of sample metadata. To get this metadata you can use RawFrameDataView.GetSampleMetadataAsInt or HierarchyFrameDataView.GetItemInstanceID.

using UnityEditorInternal;
using UnityEditor.Profiling;

public class Example { public static string GetInstanceName(int frame, int instanceId) { using (var frameData = ProfilerDriver.GetRawFrameDataView(frame, 0)) { if (!frameData.GetUnityObjectInfo(instanceId, out var info)) return "N/A"; return (frameData.GetUnityObjectNativeTypeInfo(info.nativeTypeIndex, out var typeInfo)) ? typeInfo.name + ": " + info.name : info.name; } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961