diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 0000000..888c628 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aa733b347f0144e888770c1efdb4efae +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor.meta b/Assets/Scripts/Editor.meta new file mode 100644 index 0000000..b360586 --- /dev/null +++ b/Assets/Scripts/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0b6be135b71c4efd9801464a6ada7dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor/ExportPackageWindow.cs b/Assets/Scripts/Editor/ExportPackageWindow.cs new file mode 100644 index 0000000..ac06459 --- /dev/null +++ b/Assets/Scripts/Editor/ExportPackageWindow.cs @@ -0,0 +1,44 @@ +using UnityEditor; +using UnityEngine; + +public class ExportPackageWindow : EditorWindow +{ + int majorVersion = 1; + int minorVersion = 0; + int patchVersion = 0; + + [MenuItem("Export/Export StatefulUI Package With Version")] + public static void ShowWindow() + { + // Открытие окна и установка начального размера + var window = GetWindow("Export Package"); + window.minSize = new Vector2(250, 120); + } + + private void OnEnable() + { + // Разбор текущей версии на составляющие + var versionParts = PlayerSettings.bundleVersion.Split('.'); + if (versionParts.Length == 3) + { + int.TryParse(versionParts[0], out majorVersion); + int.TryParse(versionParts[1], out minorVersion); + int.TryParse(versionParts[2], out patchVersion); + } + } + + void OnGUI() + { + GUILayout.Label("Enter the version number:", EditorStyles.boldLabel); + majorVersion = EditorGUILayout.IntField("Major Version", majorVersion); + minorVersion = EditorGUILayout.IntField("Minor Version", minorVersion); + patchVersion = EditorGUILayout.IntField("Patch Version", patchVersion); + + if (GUILayout.Button("Export")) + { + var version = $"{majorVersion}.{minorVersion}.{patchVersion}"; + ExportUnityPackage.ExportPackageWithVersion(version); + Close(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/ExportPackageWindow.cs.meta b/Assets/Scripts/Editor/ExportPackageWindow.cs.meta new file mode 100644 index 0000000..7f7af73 --- /dev/null +++ b/Assets/Scripts/Editor/ExportPackageWindow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aee4888da981432493b3087164dce6b7 +timeCreated: 1697363888 \ No newline at end of file diff --git a/Assets/Scripts/Editor/ExportUnityPackage.cs b/Assets/Scripts/Editor/ExportUnityPackage.cs new file mode 100644 index 0000000..e45c6da --- /dev/null +++ b/Assets/Scripts/Editor/ExportUnityPackage.cs @@ -0,0 +1,24 @@ +using UnityEditor; +using UnityEngine; + +public class ExportUnityPackage +{ + public static void ExportPackageWithVersion(string version) + { + PlayerSettings.bundleVersion = version; + + string[] folders = { "Assets/Plugins/StatefulUI" }; + + var exportDir = "Releases"; + if (!System.IO.Directory.Exists(exportDir)) + { + System.IO.Directory.CreateDirectory(exportDir); + } + + var packageName = $"{exportDir}/stateful_ui_{version}.unitypackage"; + + AssetDatabase.ExportPackage(folders, packageName, ExportPackageOptions.Recurse); + + Debug.Log($"Exported to: {packageName}"); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/ExportUnityPackage.cs.meta b/Assets/Scripts/Editor/ExportUnityPackage.cs.meta new file mode 100644 index 0000000..bc88958 --- /dev/null +++ b/Assets/Scripts/Editor/ExportUnityPackage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 241c2c2523bdf49cfb23ebb644a9c27f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 28b51f9..d981110 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 1.0 + bundleVersion: 1.0.2 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0