Cloud build and GIT branching workflow

Hi, I’m wondering if anyone has any suggestions for a good workflow to manage multiple build targets using GIT and cloud build. I haven’t used branching too much and don’t have extensive git experience so any general suggestions would be greatly appreciated.

From what I understand it seems to be a good idea to make separate branches for different build targets, but then I’m not clear one when to merge these and how to keep some files separate if they are only needed in one or a few branches. My game has iOS, Google Play, Amazon, PC/Mac and Steam build targets. For example, the Mac and PC versions of the Steam target are exactly the same so should I just have a Steam branch that is used in both the Steam PC and the Steam Mac targets on cloud build?

Hi @MythicalCity - I think it’s up to you, and what best suits your workflow. But I’d like to mention that build targets not only provide the ability to build different branches, they also enable you to create custom scene defines that are build target specific. For example, you could have a build target called My iOS Game that had a custom scripting define in it which you named MYIOSGAME. You could do this for each build target:

(build target / custom scripting define:)
My iOS Game / MYIOSGAME
My Google Play Game / MYGOOGLEPLAYGAME
My Amazon Game / MYAMAZONGAME
My Standalone Win Game / MYSTANDWINGAME
My Standalone Mac Game / MYSTANDMACGAME
My Steam Game / MYSTEAMGAME

Then in your Unity project you can break up your code like this:

#if MYIOSGAME
      Debug.Log("This is my iOS game code");
#endif
   
#if MYAMAZONGAME
      Debug.Log("This is my Amazon game code");
#endif

#if MYGOOGLEPLAYGAME
    Debug.Log("Here's my My Google Play code ");
#endif

#if MYSTANDWINGAME
      Debug.Log("My Stand Alone Windows Game");
#endif

etc etc. (I didn’t list them all, but you get the idea).

So instead of separating your project into different branches, you build everything from the same branch most of the time - and making new branches might only be used for something experimental, etc.

For more information on platform dependent compilation and scripting defines, check out the Unity docs here:

@hypeNate Thank you for the advice! Yes, I already do some of that to separate out the code between platforms, but I’m also interested in separating individual files and project settings between platforms. For example:

  • Steam version includes several video files and a prefab+script to manage them, these should not be in other platforms
  • Mac app store version needs a different bundleID and different application name in player settings
  • Android needs different quality settings for the high and highest setting
    etc…

So I was thinking of using branches in git to help me manage these differences and make the cloud build process easier. If that makes sense, what do you think is the best way to do that?