I get an error when building the project as a Google Play App Bundle. "Could not find a part of the path 'GameName-Version [1.1] - 7\18\2023-v4-IL2CPP.symbols.zip'." Any idea on how to solve this?
I get the following error at build time: The type or namespace name 'Build' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?) Any help?
Heads up you can also call the variables directly in strings which i personally find a little easier to read `PlayerSettings.bundleVersion = $"[{newVersion}] {date}";`
Thanks been wondering how to do this FOREVER. I think some improvements, could be using a 0.01 or something to include a version for each play in the editor. I don't tend to build often, as I am just developing, BUT every so often do versioning in the saving and backing up of files.
@@VRwithAndrew but sadly I found out it's not working with CI builds with GameCI. Its always starting with the first increment, because it's Player depending. I need something that's able to display the version in the final deployed build.
I've been using this for awhile and it worked fine, but ever since i switched build platforms to Linux(presumably the cause) the incrementing doesn't seem to work anymore. I'm not sure what the issue is, it would just give me the same application.version of the previous build instead of continuously incrementing it. any suggestions would be appreciated.
Hmmm, within the UpdateVersion function, try and put a print statement within the TryParse to see if it's actually able to add to split the version string properly and find a usable number.
@@VRwithAndrew Ok it seems like the issue was indeed from the splitting part and had nothing to do with switching build platforms, I just had the "[ ]" missing when formatting the string at the end. Thanks!
that's great but that wouldn't work if you are using Unity could build unless you commit the PlayerSettings change to version control. Do you have an example for that?
Thank you for the tutorial. It was easy to follow for my beginner's brain. I'm curious about modifying the version format from "0.0" to "000.000.000" I tried a couple of ways, just poking around, but they didn't work. If anyone has a sec and knows a solution, I'd appreciate it.
Thankfully you can change the format, just a nice showcase of how to do this. [Personally know very little about apple myself.] But the variables and version numbers can be tweaked to fit your needs.
@@VRwithAndrew yes now I am figuring out how to make it work off a scriptable and add increment major and minor editor functions. Just haven't gotten it to work without opening the scriptable in the editor after starting the editor.
Hi, To get it working on French system, where the decimal separator is a comma instead of a point, you should use this in the BuildVersionProcessor script : CultureInfo cInfo = new CultureInfo("en-EN"); if (float.TryParse(version, NumberStyles.Any, cInfo, out float versionNumber)) { float newVersion = versionNumber + 0.01f; string date = DateTime.Now.ToString("d"); PlayerSettings.bundleVersion = string.Format("Version [{0}] - {1}" , newVersion.ToString("f2", cInfo) , date); }
This was a big help. Kudos to the presentation as well. I appreciate how clearly you gave the context up front as to what problem this solves. Bummer that Apple and Google require a simple version format. But I was able to do what I needed by using a version number in the format: YYYY.MMdd.build, e.g. 2022.0618.314159
This is super! I had something similar for my project - but mine doesn't update the version and date automatically. I'll be updating mine today!
Happy to help!
Used this to change materials per platform, thanks!
Happy to help!
Thanks for providing this information. I had been wondering how to implement something like this. Now I know.
You're welcome, Anthony!
I get an error when building the project as a Google Play App Bundle. "Could not find a part of the path 'GameName-Version [1.1] - 7\18\2023-v4-IL2CPP.symbols.zip'." Any idea on how to solve this?
Thanks for the info bud. much appreciated
I get the following error at build time:
The type or namespace name 'Build' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Any help?
Did you put the script in a folder named "Editor"? This should prevent it from being included in the build.
@@VRwithAndrew right, that was it, thanks!
Can you automate it so the build file name appends the version number?
I'm not sure, it's possible but I don't personally have a way to do it.
greate video. by the way. which font are you using?
I believe it's "The Next" or "Next" font
Can't find out what's wrong, it always shows just 0.1((
Thanks, but it only works up to build 0.99. Example if the build is 0.111, the next build is 0.121 and not 0.112. ! Minor tweak to fix.
Heads up you can also call the variables directly in strings which i personally find a little easier to read `PlayerSettings.bundleVersion = $"[{newVersion}] {date}";`
Just what I needed! :d
Thanks!
Happy to help!
Thanks been wondering how to do this FOREVER.
I think some improvements, could be using a 0.01 or something to include a version for each play in the editor. I don't tend to build often, as I am just developing, BUT every so often do versioning in the saving and backing up of files.
Yeah, I kept the versioning real simple to understand. You could most likely do that by tracking the Editor events for entering/exiting play.
Nice one. Thank you very much.
You're very welcome!
@@VRwithAndrew but sadly I found out it's not working with CI builds with GameCI. Its always starting with the first increment, because it's Player depending. I need something that's able to display the version in the final deployed build.
I've been using this for awhile and it worked fine, but ever since i switched build platforms to Linux(presumably the cause) the incrementing doesn't seem to work anymore. I'm not sure what the issue is, it would just give me the same application.version of the previous build instead of continuously incrementing it. any suggestions would be appreciated.
Hmmm, within the UpdateVersion function, try and put a print statement within the TryParse to see if it's actually able to add to split the version string properly and find a usable number.
@@VRwithAndrew Ok it seems like the issue was indeed from the splitting part and had nothing to do with switching build platforms, I just had the "[ ]" missing when formatting the string at the end. Thanks!
that's great but that wouldn't work if you are using Unity could build unless you commit the PlayerSettings change to version control. Do you have an example for that?
This is more for solo devs, there are a lot of questions/potential resources online for using Github tags or commits.
Fantastic, thanks
You're welcome!
Awesome! Thank you!
Happy to help!
Is there any way to check we play the released version of the game? So click in the exe.
Yeah, you should be able to show the build number via a UI text.
Thank you for the tutorial. It was easy to follow for my beginner's brain. I'm curious about modifying the version format from "0.0" to "000.000.000" I tried a couple of ways, just poking around, but they didn't work. If anyone has a sec and knows a solution, I'd appreciate it.
AFAIK this will not work when you push your binaries to apple appstore or google play store, they require the format to be for example 0.0.1
Thankfully you can change the format, just a nice showcase of how to do this.
[Personally know very little about apple myself.]
But the variables and version numbers can be tweaked to fit your needs.
Yes, I believe you're correct!
bummer. But now I'm using version numbers in the format YYYY.MMdd.build, e.g. 2022.0618.314159
Why didn't you make this video several years ago. I have been manually setting versions for way too long!
Totally agree, same myself hehe! [Sorta, just never had an automated way of doing it.]
I wish I had figured it out years ago. :)
@@VRwithAndrew yes now I am figuring out how to make it work off a scriptable and add increment major and minor editor functions. Just haven't gotten it to work without opening the scriptable in the editor after starting the editor.
third ;D
4th!
Hi,
To get it working on French system, where the decimal separator is a comma instead of a point, you should use this in the BuildVersionProcessor script :
CultureInfo cInfo = new CultureInfo("en-EN");
if (float.TryParse(version, NumberStyles.Any, cInfo, out float versionNumber))
{
float newVersion = versionNumber + 0.01f;
string date = DateTime.Now.ToString("d");
PlayerSettings.bundleVersion = string.Format("Version [{0}] - {1}" , newVersion.ToString("f2", cInfo) , date);
}
Thanks! Was wondering why it wouldn't parse
it dont work for me Unity 2021.3.12f1, any debug.log dont trigger
using System;
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using System.Globalization;
public class BuildVersionProcessor : IPreprocessBuildWithReport
{
public int callbackOrder => 0;
private const string initialVersion = "0.0";
public void OnPreprocessBuild(BuildReport report)
{
string currentVersion = FindCurrentVersion();
UpdateVersion(currentVersion);
Debug.Log("Here1");
}
private string FindCurrentVersion()
{
string[] currentVersion = PlayerSettings.bundleVersion.Split('[', ']');
Debug.Log("Here2");
return currentVersion.Length == 1 ? initialVersion : currentVersion[1];
}
private void UpdateVersion(string version)
{
CultureInfo cInfo = new CultureInfo("en-EN");
if (float.TryParse(version, NumberStyles.Any, cInfo, out float versionNumber))
{
float newVersion = versionNumber + 0.01f;
string date = DateTime.Now.ToString("d");
PlayerSettings.bundleVersion = string.Format("Version [{0}] - {1}", newVersion.ToString("f2", cInfo), date);
Debug.Log("Here3");
}
}
}
This was a big help. Kudos to the presentation as well. I appreciate how clearly you gave the context up front as to what problem this solves. Bummer that Apple and Google require a simple version format. But I was able to do what I needed by using a version number in the format: YYYY.MMdd.build, e.g. 2022.0618.314159
Happy to be of assistance, Eddie