Implementing with Editor

Note: Tutorial implementation can be found under the GD_Example example scene

Let’s learn how we can use google data in a simple game example. We use the example document with the Google Doc Connector Example name, this should have  already been created, in the plugin settings.

Example Scene contains a simple ExampleSpawner1  script. It will spawn spheres after the Spawner1  button is pressed in the play mode. Script using public int SpawnRange and  public float SpawnDelay  as spawn settings.

To attach data to the script, we need to add the GoogleData script to the same game object. Let's attach SpawnRange to C2 cell and SpawnDelay to C3 cell.

original-1fda2a7d-556504b02013e.txt

 

Here is what we can see after pressing the Spawner1 button in play mode.

Example.unity---GoogleDocProject---PC,-Mac-&-Linux-Standalone.png

 

After Changing C2 to D2 and C3 to D3, You will see that the script values change immediately. The same as a script work result.

Example.unity---GoogleDocProject---PC,-Mac-&-Linux-Standalone.png

 

That is how easily you can bound simple value types (string, int, float, long) to the spreadsheet cell.

 

Associating Google Data with array fields

Note: Tutorial implementation can be found under GD_Example example scene

Same Example Scene contains the simple ExampleSpawner2  script. It will spawn spheres after the Spawner2  button is pressed in the play mode. This Script uses public Vector2 StartPos and public int[] SpawnArray as spawn settings.

To attach data to the script, we need to add the GoogleData script to the same game object. Let's attach StartPos.x to C6 cell and StartPos.y to C7 cell. For SpawnArray configuration let’s use Start Cell  C8 and Range Length 3.

original-4292a19c-556504b0c6f87.txt

 

Here is what we can see after pressing the Spawner2 button in play mode.

skitch.png

 

After changing the  SpawnArray Start Cell  from C8 to C11. Script work result will be changed as can be seen on the picture below.

skitch.png