- Home /
Print A Build Number to the Screen? iOS
I'd like to create a build number, increment it every time I build for iOS, and display a build number on the screen. I'd just like this for testing/bug tracking. Does anyone have any insight on the best way to go about doing this? Am I better off trying to display something else on the screen, like the bundle ID or something? Any help would be appreciated. Thanks!
(This would just be fore debug, not in the final build.)
it's a huge nuisance trying to achieve this! you're right.
FWIW click to your build settings and look at the BundleVersion. then Documentation/ScriptReference/PlayerSettings-bundleVersion.html
as always, it's incredibly astoundingly hard to just "put some text on the screen readably" in Unity. if you're not already familiar with it try using GUILabel but you won't be able to read it
if you read my long answer (actually a comment) here
about glyphdesigner etc .. we've given up and use only that process for even the simplest text on screen. so literally to do what you say, we go to all that bother! at least it finally works and you can just essentially see the result in your editor as you work and so on.
Also FWIW if you read this
http://answers.unity3d.com/questions/438153/is-guipasswordfield-buggered-.html
there is some super-handy code (search to 'Screen.height') that can make GUILabel almost usable, so that you can see it sometimes.
I hope it helps in some way
Thanks for the help! This is on the right track. I'm using 2DTool$$anonymous$$it and bmGlyph to create and display bitmap fonts. Both work great and I highly recommend them! Printing PlayerSettings.BundleIdentifier is no problem. But how do I increment it every time I build for iOS? Or is there a better way to number builds? I could probably get and display the date/time as a string and use that as a sort of build number? That way it would at least increment constantly so I would never have the same build number. Not ideal, but neither is incrementing the build number manually in the build settings.
Thanks again!
wish I could help more. I'm afraid I'm useless at build/editor scripts!
notice here I was desperately asking for help on a editor-type script :)
http://answers.unity3d.com/questions/441246/editor-script-to-make-play-always-jump-to-a-start.html
I like your idea "show the day" at least that would help ..
are you a TESTFLIGHTAPP.com user? at least that gives you a build number in the TFA app.
Yes, I'm using TestFlight and I've just been numbering the builds manually there. This is a good point. I'm not uploading all builds to TestFlight and I think it makes more sense to keep those numbers in sync. I think I'll go the BundleVersion route and increment it manually when I know I'm going to push a build to TestFlight, that way I can keep TestFlight build numbers in sync with the build number displayed on screen. I might leave the date/time on screen as well just for good measure. I want to make sure we're all referencing the same build.
Ideally I'd want to pull a version number from SVN and print that to the screen and use that as the TestFlight build number. I'm sure it's possible but it's a little over my head at this point and since I'm the only one publishing builds I think the BundleVersion solution will help.
You can use an editor script to save the version to a variable on something:
[CustomEditor(typeof(YourStorage))]
class StorageEditor : Editor {
void OnInspectorGUI() {
YourStorage ob = target as YourStorage;
GUILayout.Label("Current version:" + ob.version);
if ( GUILayout.Button("Get version from settings") )
ob.version = PlayerSettings.whatevs;
}
}
You might also be able to automate the process with this: http://docs.unity3d.com/Documentation/$$anonymous$$anual/BuildPlayerPipeline.html, but i've never used that or read much about it myself.
not-ninja edit: You could also use a menuitem to make a function that saves the version and builds the build at the same time, though BuildPlayer is pro-only:
// class doesn't mattter, just jam it in an Editor folder
[$$anonymous$$enuItem("Tools/Build With Version %g")]
static void VersionBuild() {
Something.version = PlayerSettings.whatever;
BuildPipeline.BuildPlayer(parameters);
}
http://docs.unity3d.com/Documentation/ScriptReference/BuildPipeline.BuildPlayer.html
Answer by SilentSin · Feb 17, 2016 at 08:06 AM
Sorry for responding to such an old thread, but anyone who finds this might be interested in my Procedural Asset Framework (https://www.assetstore.unity3d.com/en/#!/content/52447). It has an AppDetails script which gives you automatic build numbering (as an int), as well as a build time stamp (as a DateTime). It also gives you runtime access to the product name and company name you specify in the player settings.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Accessing quadrant/joystick number when using multiple xbox 360 controllers 1 Answer
Broadcast rendered camera through networking. 1 Answer
Small resolution + full screen = everything is blurry! 0 Answers
How can I find the line number in flash build error (simple)? 1 Answer