Skip to content

Support buildProfile in combination with androidVersionCode #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davidmfinol opened this issue Feb 17, 2025 · 1 comment
Open

Support buildProfile in combination with androidVersionCode #691

davidmfinol opened this issue Feb 17, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@davidmfinol
Copy link
Member

Per @MichaelBuhler

You can set the Android Bundle Version Code within the Build Profile itself. In this case I suppose that you would run the GitHub action with buildProfile: ... and versioning: None.

However, if you want to rely on the GitHub action to determine the version code... I think I have not implemented that--actually, it might even be impossible:

After we load the BuildProfile from the /Assets folder, the object has no public members or methods by which we can modify/edit the Build Profile at runtime.

From decompiled code, I can see that the BuildProfile class has internal classes and getter/setters, as well as private members, that hold the platform build settings and player overrides deserialized from the build profile asset. There also seems to be no public constructor, so you cannot instantiate/build the build profile at runtime.

I would guess that Unity will add these features/abilities in a later version, but they do not seem to be in Unity 6.1 Beta, yet.

So, I suppose the only possible solution today would be to modify (edit in place) the build profile's .asset YAML before launching the build. For instance, I just made a new Android Build Profile and set Bundle Version Code: 990099:

Screenshot 2025-01-31 at 1 49 27 PM

This resulted in this on line 206 of the .asset file:

    - line: '|   AndroidBundleVersionCode: 990099'

So we would have to Regex replace that 6-digit value before launching Unity.

Originally posted by @MichaelBuhler in #685 (comment)

@webbertakken
Copy link
Member

webbertakken commented Feb 17, 2025

After we load the BuildProfile from the /Assets folder, the object has no public members or methods by which we can modify/edit the Build Profile at runtime.

That might also be an argument to stick with the custom build method for now (I don't mean exclusively).

@davidmfinol davidmfinol added the enhancement New feature or request label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants