public static void OnPostProcessBuild(BuildTarget target, string buildPath) { var b = new ShowBuildVersion.BuildVersion(); try { b = b.FromJson("buildInfo.json"); if (b == null) { b = new ShowBuildVersion.BuildVersion(); } b.buildNr++; } catch { Debug.Log("buildInfo.json created in streaminAssets"); } b.buildDate = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (b.versionHistory == null) { b.versionHistory = new List <string>(); } b.versionHistory.Insert(0, b.ToString()); b.ToJson("buildInfo.json"); Debug.Log("Finished build nr " + (b.buildNr - 1)); }
public static void OnPostProcessBuild(BuildTarget target, string buildPath) { if (!System.IO.Directory.Exists(Application.streamingAssetsPath)) { System.IO.Directory.CreateDirectory(Application.streamingAssetsPath); Debug.Log("Created streaming assets directory"); } var b = new ShowBuildVersion.BuildVersion(); try { b = b.FromJson(fileName); if (b == null) { b = new ShowBuildVersion.BuildVersion(); } b.buildNr++; } catch (System.Exception e) { Debug.Log("Exception " + e.Message); } b.buildDate = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (b.versionHistory == null) { b.versionHistory = new List <string>(); } b.versionHistory.Insert(0, b.ToString()); b.ToJson(fileName); Debug.Log("Finished build nr " + (b.buildNr)); }
void ReadVersionOffline() { #if UNITY_EDITOR Text text = GetComponent <Text>(); ShowBuildVersion.BuildVersion buildVersion = null; buildVersion = buildVersion.FromJson(IncrementBuildVersion.fileName); if (buildVersion != null) { text.text = "Build " + (buildVersion.buildNr); // gets incremented after succesful build\ } if (addUntiyVersion) { text.text += " Unity: " + Application.unityVersion; } #endif }
public static void PrintCurrentVersion() { var b = new ShowBuildVersion.BuildVersion(); try { b = b.FromJson(fileName); if (b == null) { Debug.Log("Failed to read " + fileName); } Debug.Log("Last build had number: " + (b.buildNr - 1) + "built on " + b.buildDate); } catch { Debug.Log("Failed to read buildInfo.json"); } }
public static void DecreaseCurrentVersion() { var b = new ShowBuildVersion.BuildVersion(); try { b = b.FromJson(fileName); if (b == null) { Debug.Log("Failed to read " + fileName); } { b.buildNr--; b.buildDate = "version was manually decreased"; } b.ToJson(fileName); Debug.Log("Decreased version to " + b.buildNr); } catch { Debug.Log("Failed to read " + fileName); } }