settingsPath | 要选择的项目设置路径(例如,'Preferences/Keys' 或 'Preferences/2D')。 |
EditorWindow 返回 Settings 窗口的实例。
打开“首选项”窗口,其中已选择指定的设置项目。
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"); } } }