game-ci / game-ci/unity-builder
Support buildProfile in combination with androidVersionCode
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 313
- Avg merge
- 1h 39m
- Merged PRs (30d)
- 1
Description
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`](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Build.Profile.BuildProfile.html) 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`:
This resulted in this on line 206 of the `.asset` file:
```yaml
- line: '| AndroidBundleVersionCode: 990099'
```
So we would have to Regex replace that 6-digit value before launching Unity.
_Originally posted by @MichaelBuhler in https://github.com/game-ci/unity-builder/pull/685#discussion_r1936759117_
Contributor guide
Assessment
This issue has not been assessed yet.