Version: 2021.3

SettingsService.OpenUserPreferences

切换到手册
public static EditorWindow OpenUserPreferences (string settingsPath);

参数

settingsPath 要选择的项的设置路径(例如,“Preferences/Keys”或“Preferences/2D”)。

返回

EditorWindow 向 Settings 窗口返回一个实例。

描述

打开 Preferences 窗口,其中已事先选择指定的设置项。

using UnityEditor;
using UnityEngine;

class MyCustomWindow : EditorWindow { void OnGUI() { if (GUILayout.Button("Open my custom preference")) { SettingsService.OpenUserPreferences("Preferences/MyCustomPref"); }

if (GUILayout.Button("Open my custom project settings")) { SettingsService.OpenProjectSettings("Project/MyCustomSettings"); } } }