Live Update

Description

Live update let you update database data on player's devices using Google Sheets, using public GoogleSheets Json API.

Restrictions

  1. WebGl platform is not supported
  2. Do not use this addon to update critical data. There is a chance some users won't be able to download updates (due to network issues for example).
  3. API calls have usage limits. Read more details here If you reach the limit, GoogleSheets will not return correct feed and LiveUpdate plugin will fail.
  4. Plugin uses formatted values, not raw value. If you use numeric fields, please, make sure formatted value for these fields are the same as raw values (you may need to change cells formatting)

How it works

  1. First time your game is launched and database is loaded, it'll try to read data from Google Sheets
  2. If step 1 is successful, every time database is loaded, it will be merged with data from Google Sheets, thus applying the update.
  3. If step 1 is unsuccessful, database data will remain intact.

Setting up

  1. Enable LiveUpdate plugin (under addons->LiveUpdate)
  2. Get "API key" from Google. Assign it to API key LiveUpdate addon parameter
  3. Get Spreadsheet Id from Google. Assign it to Spreadsheet Id LiveUpdate addon parameter
  4. Make sure to share target spreadsheet. Open target spreadsheet, click on Share button on the top right and set access level to "public" or "people with link". Otherwise you will get 403 error from GoogleSheets

Checking if setup was correct

You can check if you set up config properly by accessing this address from your browser (make sure it returns valid json, not some error )
For example, for the following parameters
  1. SpreadsheetId=MYko0fxH01GIJcBq41YAT9eFpU6Znm5I5RByHsJpupHZ
  2. ApiKey=RYIzaSyB0xsc_BoOBNRHfhW9xpCx1t03a-gV6qc
  3. Meta=Items
the correct URL would be: This is not a working example, it's just an example how to substitute parameters.

Parameters

Parameter name Description
Spreadsheet Id Id of your spreadsheet. Learn how to obtain it here
API key API key to use for request. Learn how to create it here
Timeout Timeout for connection. Value (in seconds) is between 1-30, default is 5
Manual Load Set it to true if you do not want this addon to be executed automatically. In this case, you will need to manually trigger the loading by calling
BGRepo.I.Addons.Get<BGAddonLiveUpdate>().Load(true);
In Builds Only Setting this to true will disable addon if your game is run in Editor. It will work in builds only. It is recommended to set it to true as soon as you are sure the addon works correctly.
Merge Settings The same merge settings you use for Export/Import or Saving/Loading. Learn more about merge settings here
Log level level of details to be used while gathering log information. Logs messages are gathered while addon tries to read information from GoogleSheets
Print log on load If set to true, log will be printed to Unity console after load attempt
Value resolver type Full C# type name to be used to convert GoogleSheets values to another format. This type should implement BansheeGz.BGDatabase.BGLiveUpdateValueResolver interface. For example, you could use currency formatted values inside GoogleSheet for int fields ($5,200). To properly read such values you need to convert them to valid int values ($5,200->5200). Here is an example implementation of such type, which do such conversion.