using System; using System.Diagnostics; using System.IO; using UnityEditor; using Object = UnityEngine.Object; namespace TyphoonPool { public class _Editor { private static string _rootPath = null; private static string RootPath { get { if (_rootPath == null) { var p1 = $"Assets/xgame.unity.pool"; var p2 = $"Packages/xgame.unity.pool"; if (Directory.Exists(p1)) { _rootPath = p1; } else if (Directory.Exists(p2)) { _rootPath = p2; } } return _rootPath; } } [MenuItem("Typhoon/Pool/使用说明")] private static void ReadMe() { var path = $"{RootPath}/typhoon.unity.pool使用说明.pdf"; if (!File.Exists(path)) { throw new Exception($"找不到:{path}"); } EditorApplication.ExecuteMenuItem("Window/General/Project"); EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(path)); Process.Start(new FileInfo(path).FullName); } } }