- public class GenerateUnityPackage : MonoBehaviour
- {
- static private int count =1;
- #if UNITY_EDITOR
- [MenuItem("Framework/1.自动导出Framework包 %E")]
-
- private static void GenerateUnityPackageName()
- {
- string strAssetFileFolder = "Assets/Framework";
- string strSavePath = "Framework_" + DateTime.Now.ToString("yyyy_MM_dd_HH") + ".unitypackage";
- AssetDatabase.ExportPackage(strAssetFileFolder, strSavePath, ExportPackageOptions.Recurse);
- Debug.Log("已导出包:"+strSavePath);
-
- Application.OpenURL("file:///" + Application.dataPath+"/..");
-
- }
- #endif
- }
记录几个常用的API
// 拷贝到剪切板
GUIUtility.systemCopyBuffer = DateTime.Now.ToString("yyyy_mm_dd_HH");
// 执行指定的menuitem
EditorApplication.ExecuteMenuItem("Framework/1.自动导出Framework包");