-
-
Notifications
You must be signed in to change notification settings - Fork 12
How to Setup Google
One Google service covers three separate things: Google Drive (upload builds), Google Play (publish Android builds) and Google Chat (post messages). They all share the same Enabled toggle and the same list of Apps, so this page sets up all three.
!NOTE: The Google service is marked Experimental. It works, but expect rough edges.
You only need the parts you'll actually use. Setting up Drive does not require Play or Chat.
| I want to... | I need |
|---|---|
| Upload a build to Google Drive | An App with a token (§1, §2) + a Drive Folder (§3) |
| Publish an Android build to Google Play | An App with a token (§1, §2) + a Play App (§4) |
| Post a message to a Google Chat space | A Chat Space webhook (§5) — no App or token needed |
The Build Uploader splits Google setup across two windows on purpose:
-
Edit->Preferences->Build Uploader->Services->Googleholds your tokens. These are saved to your own PC only and are never written into your project. Every person on your team enters their own. -
Project Settings->Build Uploader->Services->Googleholds names, folder IDs and package names. These are saved to<YourProjectPath>/BuildUploader/and are safe to commit so your team shares them.
So the pattern is always the same: create the entry in Project Settings, then enter its secret in Preferences.
The Build Uploader talks to Google using an OAuth2 access token. Getting one is a two step process - make an app in Google Cloud, then trade it for a token.
- Go to Google Cloud Console - Credentials
- (Or press the
Cloud Consolebutton at the top of the Preferences page)
- (Or press the
- Create a new project if you don't have one (top left project dropdown ->
New Project) - Turn on the API you need for the thing you want to do
- Go to
APIs & Services->Library - For Drive: search
Google Drive APIand pressEnable - For Play: search
Google Play Android Developer APIand pressEnable
- Go to
- Create the credentials
- Go back to
APIs & Services->Credentials - Press
Create Credentials->OAuth client ID - If asked to configure a consent screen, do that first.
External+ your own email is fine for a personal project - Application type:
Web application - Under
Authorised redirect URIspressAdd URIand enter exactly:https://developers.google.com/oauthplayground
- Press
Create - Copy the Client ID and Client Secret it shows you. You need them in the next step
- Go back to
!NOTE: While your consent screen is in
Testingmode you must add your own Google account underAudience->Test users, or the next step will refuse to authorise.
- Go to the OAuth 2.0 Playground
- (Or press the
OAuth Playgroundbutton at the top of the Preferences page)
- (Or press the
- Press the gear icon (top right)
- Tick
Use your own OAuth credentials - Paste in the Client ID and Client Secret from step 1a
- Tick
- In the list on the left, find and tick the scope you need:
- For Drive:
Google Drive API v3->https://www.googleapis.com/auth/drive.file - For Play:
Google Play Android Developer API v3->https://www.googleapis.com/auth/androidpublisher - (Tick both if you want one token to do both jobs)
- For Drive:
- Press
Authorize APIsand sign in with the Google account that owns the Drive/Play content - Press
Exchange authorization code for tokens - Copy the Access token (the long string starting with
ya29.)
!WARNING: A Google access token expires after about 1 hour. The Build Uploader does not refresh it for you - it sends exactly what you paste in. If an upload fails with a
401, come back to the Playground, pressExchange authorization code for tokensagain, and paste the new token in.
- Turn on
Enabled - Under
Appspress+to create a new App-
Name: anything you like. This is just a label so you can pick it in a dropdown later. eg:Release Uploader -
Token: paste the access token from step 1b- Tick
Showif you want to see what you pasted
- Tick
-
That's the only secret Drive and Play need.
- Under
Appspress+ - Enter the exact same
Nameyou used in Preferences
!NOTE: The Name is the link between the two windows. If they don't match, the Build Uploader won't find your token.
- Open the folder in Google Drive in your browser
- Look at the URL:
https://drive.google.com/drive/folders/1AbCdEfGhIjKlMnOpQrStUvWxYz- The part after
/folders/is the Folder ID
- The part after
- Back in Unity, under
Drive Folderspress+-
Name: anything you like. eg:Nightly Builds -
Folder ID: paste the ID from the URL
-
- Leave the list empty (or the Folder unset in the destination) to upload to the root of My Drive instead
- Go to
Window->Build Uploader->Open Window - Add a
Google Drivedestination to your Upload Config-
App: the App you made -
Folder: the Drive Folder you made (orMy Drivefor the root) -
File Name: what the file will be called on Drive. Comes pre-filled with a sensible default- Supports
{keys}- see String Formatter
- Supports
-
Zip Contents: leave this on if your source is a folder. It zips the folder and uploads one file- Turn it off to upload each top level file separately. Sub folders are skipped when off
-
After uploading, the App name, Folder name, uploaded file ID and a link to view the file on Drive are all available as {keys} to any later destination or action. See String Formatter for their names.
!NOTE: Your token must have been authorised with the
androidpublisherscope (step 1b). A Drive-only token will not work here.
Your Google account also needs to be invited to the Play Console with permission to release, and the app must already have had one build uploaded manually - Google rejects API uploads to an app that has never had a release.
- Under
Play Appspress+-
Name: anything you like. eg:My Game (Android) -
Package: the application ID from the Play Console. eg:com.example.MyGame
-
- Add a
Google Playdestination-
App: the App you made in §2/§3 -
Play App: the Play App you just added -
Track:Internal,Alpha,BetaorProduction -
Release Status:completedrolls out immediately,draftstages it for you to roll out by hand in the Play Console -
Release Name/Release Notes: optional, both support{keys} -
Binary File Name: leave empty and it will auto-detect a single.aabor.apkin your source folder. Set it (eg:game.aab) if there's more than one
-
After uploading, the package name, track, version code and edit ID are all available as {keys} to any later destination or action. See String Formatter for their names.
Chat is the odd one out - it uses a webhook URL, not the App/token from steps 1 and 2. You can set this up without doing any of the above (other than turning Enabled on).
- Open the Google Chat space you want messages posted to
- Press the space name at the top ->
Apps & integrations - Press
Manage webhooks(orAdd webhooks) - Give it a name (eg:
Build Uploader) and pressSave - Copy the URL it gives you
- Google's instructions if the menu has moved
!NOTE: Webhooks are a Google Workspace feature. Personal
@gmail.comaccounts don't have this option.
-
Project Settings->Build Uploader->Services->Google- Under
Chat Spacespress+and give it aName. eg:Team Builds
- Under
-
Edit->Preferences->Build Uploader->Services->Google- Under
Chat Spacesfind the same name and paste the URL intoWebhook
- Under
- Add a
Google Chat Send Messageaction (not a destination)-
Space: the Chat Space you made -
Text: the message. Supports{keys}- see String Formatter -
Message Name Format: optional. Leave empty unless a later action needs to reference this message
-
- Set
TriggerstoOnTaskFinishedandWhen To ExecutetoAlwaysto get a message whether the upload passed or failed
The Chat Space name is also available as a {key} to any later destination or action.