Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Released] Google Doc Connector

Discussion in 'Assets and Asset Store' started by stanislav-osipov, Jul 26, 2014.

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    This plugin allows you to use Google SpreadSheets as a config storage for your game. The data is available via a scripting API or you can connect the data source to any MonoBehaviour class field, using Unity editor. You can learn more on how to use the plugin in the Guidelines chapter.


    Available on Asset Store | Documentation | Tutorials

    Supported data types are:
    • string, int, float, long
    • <supported_type>[],
    • List<supported_type>
    • Dictionary<supported_type, supported_type>
    Editor Implementation

    This plugin has unity editor implementation. Which means you can connect data from spreadsheet cells to any field of your MonoBehaviour script. Data can be connected to any field, if the field type is supported. Data retrieval is recursive. For example Vector3 class is a serializable class with x,y,z float fields - you can connect data to these fields. The same applies to your own scripts.

    Advantages of keeping data in Google Spreadsheets
    1. Game designers and programmers can modify config data without access to the code
    2. You may use spreadsheet formulas to calculate dependencies between a config value, which is extremely helpful for designing and configuring the game balance.
    3. The project config can be very user friendly and readable. Instead of XML and JSON or Yaml files. You may use all of the formatting power of Google Spreadsheets.
    4. You will never lose a thing, since the google docs have a full revision history.
    5. You can store the localization in Spreadsheets, so it can be easily accessed and modified by translators.

    The requested data is cached, and stored as text files in the project Resources folder. You can find advantages and disadvantages to this approach below.

    Advantages:
    • Once data is cached, the editor will not do any WWW calls anymore
    • The application that has been built will not do any WWW calls
    • Requested data is delivered immediately, without any time outs
    • You can see what document version you are using in the plugin setting, so you can decide when to update data cash to your project from google doc. So if somebody spoils some data in the doc, it will have zero effect on your project.
    Disadvantages
    • Data is not realtime. You can not get the updated value on the fly. You need to re cash the document in order to use the updated data.

    Here how retrieving data using editor look like:
    1) Press the “Add new connection” button and select GD_ExampleDataScript and worksheet (Optional) .



    2) Press “Attach Filed” and choose MyString filed.



    3) In field data delegate settings choose data source.

    4) Specify Cell key in Worksheet, e.g. 'A1' .



    The same actions for data types: string, int, float, long.


    And here is small coding example

    The Code example for how to retrieve selected range from GoogleDocConnectorExample spreadsheet as List<int>.


    Code (CSharp):
    1.  
    2. //Retriving data range into list<int>
    3.  
    4. List<int> array;
    5. GDCellRange range =  new GDCellRange();
    6. range.StartCell =  new GDCell("C11");
    7. range.useLinebreak = true;
    8. range.LineLength = 3;
    9.  
    10. array = GoogleDocAPI.GetList<int>(DOC_NAME, range);
    11.  
    12. //Printing list values
    13. foreach (int data in array) {
    14. Debug.Log("List Data: " + data);
    15. }
    More information can be founded here:

    Guidelines
    Tutorials and Use Examples

    I hope you Enjoy Using The plugin :)
     
    Last edited: Nov 22, 2014
  2. Eneco

    Eneco

    Joined:
    May 28, 2013
    Posts:
    16
    Hey Stan, there seem to be a conflict with the InControl asset (https://www.assetstore.unity3d.com/en/#!/content/14695)

    Error 1 The type "System.Action" is defined in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Subset v3.5\System.Core.dll" and also in "...\Assets\Extensions\GoogleDocConnector\DLL\Newtonsoft.Json.dll" . From ...\Assets\3rdParty\InControl\Library\InputManager.cs 17 23 UnityVS.Game.CSharp
    Error 2 The type "System.Action<T1,T2>" is defined in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Subset v3.5\System.Core.dll" and also in "...\Assets\Extensions\GoogleDocConnector\DLL\Newtonsoft.Json.dll" . From ...\Assets\3rdParty\InControl\Library\InputManager.cs 18 23 UnityVS.Game.CSharp

    It worked fine before importing your asset - please fix it :)
     
  3. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks for reporting.
    I will fix and submit this in few hours. If you need fix before it got's live on assets store, please send message to stans.asstes@gmail.com and support team will send latest version for you.
    Cheers!
     
  4. Bionicle_fanatic

    Bionicle_fanatic

    Joined:
    Jun 8, 2013
    Posts:
    368
    Hi lacost,
    This looks like a pretty brilliant plugin! [:D] I'd just like to query a coupla' things though:

    I'm making an MORPG running in the photon cloud, and I need an online data store for my player's stats and accounts, such as login passwords, usernames, inventory items etc. Would I be able to store all that info in a GDoc via your plugin, then access it when needed?

    Many thanks [:)]
     
  5. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks!
    But I afraid you misunderstood the plugin concept.

    It's not a data base with you can access at runtime, select, update an delete data. For this purposes you should use common data base solutions MySQL, Mongodb, etc.

    The plugin is allow you store your game data configs. Like for example your MORPG Weapons Stats, NPC Dialogs, mob spawns, etc. Point is you will able to store in google spreadsheet, with you can format as you like, and share it with people you want. Instead fo storing this data in XML or JSON files, Prefabs, etc.


    Plugin is retrieving data from Google Doc when you pressing "Load / Update" button in plugins settings. Google doc data is cashed, and can be accessible in runtime or editor mode. But it will not do any Web calls in runtime it will use document cash. And you manually select when to update this cash using plugins settings editor window.

    Cheers!
     
  6. Bionicle_fanatic

    Bionicle_fanatic

    Joined:
    Jun 8, 2013
    Posts:
    368
    Ah, okay. I see.... Guess it's time to learn MySQL, then... [:p]
     
  7. Deleted User

    Deleted User

    Guest

    Hi lacost,

    I am using a sqlite database for data handling in my project, which is a bicycle catalogue. There are 26 tables with data for bikes in and I sometimes I need to update these data at runtime. For example, have to set new prices or implement new parts. Because my customer should have always newest information in their app.
    I want to do this with sheets from google, because I already have stored the updated information there.
    So, the sheet is looking like this:
    BikeTypeId, BikeTypeNumber, BikeTypeName, BikeTypeprice1...
    What I want to do is, if I press a button, I will read data from a google document with a specified sheet and import the data.
    Best is, that I can read the first line with structure and type of table, like BikeTypeId:integer, BikeTypeNumber:string, BikeTypeName:string.
    Is this possible to handle with your asset?
    thanks a lot in advance for answering.
     
  8. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Well yes it's possible, you can see coding example in the first post.
    But as i mentioned you can not change data in runtime, it's like static config with is stored in your project, but you can load this config from google sheets.

    Here is Advantages and Disadvantages of such approach

    Advantages:
    • Once data is cached, the editor will not do any WWW calls anymore
    • The application that has been built will not do any WWW calls
    • Requested data is delivered immediately, without any time outs
    • You can see what document version you are using in the plugin setting, so you can decide when to update data cash to your project from google doc. So if somebody spoils some data in the doc, it will have zero effect on your project.
    Disadvantages
    • Data is not realtime. You can not get the updated value on the fly. You need to re cash the document in order to use the updated data.
     
  9. Tom-G

    Tom-G

    Joined:
    Jun 24, 2014
    Posts:
    7
    Hi Stan, I hope you don't mind me resurrecting this thread, but I have a question:

    Since the example requires the Google spreadsheet to be shared as 'public' and visible to anyone with the link, does that rule out having a username/password secure login for the Google document?

    If this asset doesn't include that functionality then I guess it would be something that I could bolt on, using OAuth and Google Service accounts.

    Thanks,
     
  10. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    While this asset was at the development stage. I was using OAuth, but the decided to get rid of this functionality.
    Since after sharing this asset among lot's of developer turns out nobody need this functionality, and here is the reason why:
    For example I work with the team of developers, and I need to create config doc. If I will create it with my acc, is ould need to put my acc credentials in the plugins settings. And even if plugin will try to hide it, it anyway will be assessable for anyone how has access to the project and know scripting a bit :) And since acc credentials should be stored in the setting different people can't put different credentials in the setting, it will lead to the conflict.
    I hope you got what I mean.
    So from my standpoint this feature is useless. But you can feel free to modify any plugin source code for you project needs.

    Cheers!
     
    Tom-G likes this.
  11. Tom-G

    Tom-G

    Joined:
    Jun 24, 2014
    Posts:
    7
    Thanks Stan. For the benefit of others, I think there may be a solution to this problem using a Google Service Account, which acts as a sort of proxy account. Someone creates the spreadsheet and shares it with the Service Account, and then the codebase only requires the credentials for this one account in order to access/edit the documents -- no matter which developer is using it.
     
  12. SecretBox

    SecretBox

    Joined:
    May 18, 2015
    Posts:
    13
    Hi, Just bought the plugin for an iOS app.

    The spreadsheet is showing it is imported ok into the unity editor.

    But I'm getting 0 Languages Detected showing even though I have set the headings with the country codes like the example sheet.

    When I add the Google Data (Script) I'm getting No valid data receivers available.
    What should I do?

    Thanks,
    Lance
     
  13. SecretBox

    SecretBox

    Joined:
    May 18, 2015
    Posts:
    13
    I've found that by exiting and restarting it is now finding the languages ok, but still getting No vail data receivers available.
     
  14. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello!
    Please, refer this Google Doc Connector integration guide document.
    The exact case as you have is described there. Hope, this information will be helpful and you will find the answer to your questions.