版本号变更

This commit is contained in:
2025-12-25 01:14:17 +08:00
parent 69713e9946
commit 7bf59aa898
2 changed files with 12 additions and 3 deletions
@@ -2,6 +2,7 @@ using System;
using UnityEditor; using UnityEditor;
using UnityEditor.Build; using UnityEditor.Build;
using UnityEditor.Build.Reporting; using UnityEditor.Build.Reporting;
using UnityEngine;
public class VersionIncrementer : IPreprocessBuildWithReport public class VersionIncrementer : IPreprocessBuildWithReport
{ {
@@ -23,5 +24,13 @@ public class VersionIncrementer : IPreprocessBuildWithReport
// 更新版本号 // 更新版本号
string date = DateTime.Now.ToString("yyyyMMdd-HHmmss"); string date = DateTime.Now.ToString("yyyyMMdd-HHmmss");
PlayerSettings.bundleVersion = $"{major}.{minor}.{revision}.{build + 1}-{date}"; PlayerSettings.bundleVersion = $"{major}.{minor}.{revision}.{build + 1}-{date}";
// 如果是Android平台,自增Bundle Version Code
if (report.summary.platform == BuildTarget.Android)
{
int currentVersionCode = PlayerSettings.Android.bundleVersionCode;
PlayerSettings.Android.bundleVersionCode = currentVersionCode + 1;
Debug.Log($"Android Bundle Version Code incremented: {currentVersionCode} -> {PlayerSettings.Android.bundleVersionCode}");
}
} }
} }
+3 -3
View File
@@ -133,7 +133,7 @@ PlayerSettings:
vulkanEnableLateAcquireNextImage: 0 vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1 vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0 loadStoreDebugModeEnabled: 0
bundleVersion: 0.3.3.50-20251224-211503 bundleVersion: 0.3.3.52-20251225-010125
preloadedAssets: preloadedAssets:
- {fileID: 11400000, guid: 0fb2bc2476953fc43a74f0ab8879077c, type: 2} - {fileID: 11400000, guid: 0fb2bc2476953fc43a74f0ab8879077c, type: 2}
metroInputSource: 0 metroInputSource: 0
@@ -163,7 +163,7 @@ PlayerSettings:
iPhone: 0 iPhone: 0
tvOS: 0 tvOS: 0
overrideDefaultApplicationIdentifier: 1 overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 15 AndroidBundleVersionCode: 17
AndroidMinSdkVersion: 22 AndroidMinSdkVersion: 22
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
@@ -266,7 +266,7 @@ PlayerSettings:
AndroidEnableTango: 0 AndroidEnableTango: 0
androidEnableBanner: 1 androidEnableBanner: 1
androidUseLowAccuracyLocation: 0 androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 1 androidUseCustomKeystore: 0
m_AndroidBanners: m_AndroidBanners:
- width: 320 - width: 320
height: 180 height: 180