-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ff2202
commit a5c8e43
Showing
7 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ExportPackageWindow>("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(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}"); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters