using UnityEditor; using UnityEngine; using UnityToolbarExtender; [InitializeOnLoad] class APINavigation : INavigation { public int Order => 50; static APINavigation() { ToolbarExtender.AddToLeft(new APINavigation()); } public void OnGUI() { EditorGUI.BeginDisabledGroup(Application.isPlaying); if (GUILayout.Button("Unity API", ToolbarStyles.apiButtonStyle)) { Application.OpenURL("https://docs.unity.cn/cn/current/Manual/index.html"); } EditorGUI.EndDisabledGroup(); } static class ToolbarStyles { public static readonly GUIStyle apiButtonStyle; static ToolbarStyles() { apiButtonStyle = new GUIStyle("Command") { fixedWidth = 80, fontSize = 13, alignment = TextAnchor.MiddleCenter, imagePosition = ImagePosition.ImageAbove, fontStyle = FontStyle.Bold }; } } }