Version: 2022.3
언어: 한국어

ProfilerWindow.SelectedFrameIndexChanged

매뉴얼로 전환

파라미터

value The zero-based index of the frame currently selected in the Profiler Window. A long.

설명

Calls the methods in its invocation list when the Profiler window’s selected frame index changes.

The Profiler window’s selected frame index may change for a variety of reasons, such as a new frame being captured, the user selecting a new frame, or a new capture being loaded.

using UnityEditor;
using UnityEngine;

public class Example : EditorWindow { ProfilerWindow m_Profiler; long m_SelectedFrameIndex;

[MenuItem("Window/Analysis/Profiler Extension")] public static void ShowExampleWindow() { GetWindow<Example>(); }

void OnEnable() { // Make sure there is an open Profiler Window. if (m_Profiler == null) m_Profiler = EditorWindow.GetWindow<ProfilerWindow>();

// Subscribe to the Profiler window's SelectedFrameIndexChanged event. m_Profiler.SelectedFrameIndexChanged += OnProfilerSelectedFrameIndexChanged; }

private void OnGUI() { GUILayout.Label($"The selected frame in the Profiler window is {m_SelectedFrameIndex}."); }

private void OnDisable() { // Unsubscribe from the Profiler window's SelectedFrameIndexChanged event. m_Profiler.SelectedFrameIndexChanged -= OnProfilerSelectedFrameIndexChanged; }

void OnProfilerSelectedFrameIndexChanged(long selectedFrameIndex) { // Update the GUI with the selected Profiler frame. m_SelectedFrameIndex = selectedFrameIndex; Repaint(); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961