Search Unity

[Released] G2U 2.1.13 - Use Google Spreadsheets in Unity

Discussion in 'Assets and Asset Store' started by Shane-C, Oct 14, 2013.

  1. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Hey Tom,
    Are you using the Type row?
    Are you using the keyword VOID or are you leaving the header blank?
    Are rows using the header VOID exporting as well?

    I'm trying to reproduce this bug so I can get it fixed ASAP! (I've released 2 bugfix versions in 3 days.. I'm on a roll! ;-) )

    edit: I'm at work at the moment, so any bugfix releases will have to be done later this evening. There's another oddity that I'm trying to track down as well, but I will certainly get this working for you in the meantime.
     
  2. CrunchingTom

    CrunchingTom

    Joined:
    Mar 29, 2011
    Posts:
    42
    Hey there,

    This is how my spreadsheet looks like:


    I have some strings in a VOID column- they are translated/transformed into a column on the right. Only the column on the right should be imported, which worked until converting to G2U from GoogleFu.

    Hope that helps! :)

    Cheers,
    Tom
     
  3. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Ok, so you are using the keyword, and no type row. Got it. I'll let you know what I come up with asap
     
  4. Disastercake

    Disastercake

    Joined:
    Apr 7, 2012
    Posts:
    314
    Hey G2U team! Is there an API for reading the CSV files, or just saving them?
     
  5. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    202
    We updated to the latest version and all the icons are not showing up. Not a big deal as we can just hover over them and read the tooltips, but I thought I'd mention it. Only reason I think of is because we didn't import the sample folder?
     
  6. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    There is no API for reading CSV files directly, however if you use Google's import feature, or our "Upload a Workbook" feature, it will be converted into a Google Spreadsheet ready for G2U to process.

    Shizola: The resources for the icons were moved to:
    • /Assets/Editor Default Resources/G2U
    Ensure you imported that folder.

    You may have a duplicate set from the previous version.
    Look in:
    • Standard Assets/Editor/Google2u/EditorAssets
    and remove that folder.
     
  7. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    202
    Thanks, that fixed it . Strangely, the "Editor Default Resources" folder wouldn't show up in the import page until I deleted the standard assets folder. Not sure what that's all about.
     
  8. CrunchingTom

    CrunchingTom

    Joined:
    Mar 29, 2011
    Posts:
    42
    Hey there!

    Anything new in the "VOID keyword department"? ;)

    Cheers,
    Tom
     
  9. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Sorry Tom, still working on it.. I ended up getting swamped with work. I do know that if you are not using the type row, and you remove the word VOID entirely, then it does work. I'll see if I can get it working as intended with the VOID keyword tonight.
     
  10. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    2.1.5 has been released, this should fix all remaining void column issues.

    KNOWN ISSUE!

    Sometimes when you first export an Object Database and the script is created from scratch, G2U will drop some of the data. We are looking into this, but haven't been able to pinpoint the issue yet. The workaround, simply re-export the Object Database again, and everything will populate normally. As we've witnessed, this usually only happens once, and only the first time you export (Or if you delete the scripts).
     
    johanneskopf likes this.
  11. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    425
    Hey Shane,

    Thanks for your plugin, man! All good so far.

    One question: what is the difference between GetRow() and GetGenRow() and when to use which?

    Thanks again!
     
  12. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    425
    Ah, as a second question: is it possible to stop your plugin from making empty folders in my project root? For someone with a massive project like mine, this means a lot of clutter that I'd rather not have. I found out that I could point all the export paths to the same folder, but the root folder (Google2uGen) and one subfolder (NGUI) will be created regardlessly.

    I'd say it's a good suggestion to not create these folders when there are no worksheets that need to be exported to it, right?
     
  13. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    425
    Aaaand thirdly, the above also kind of applies to the folder called "Editor Default Resources". Can this folder go into your main plugin folder too?
     
  14. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Back to front:

    According to the wiki, which is the only place I've ever found in-depth information on the Editor Default Resources folder, "Afaik,only one "Editor Default Resources" folder can be present, and it has to be directly under the top Assets folder". The manual also has a small blurb about it and confirms what the wiki suspects.

    I admit I didn't do a lot of in-depth testing on this subject. I relocated the assets to this folder to prevent them from being included in the final build of your game (Because you really don't need the docs and icons anyway, right?).

    Making unnecessary folders: This has been on my radar for a while, but keeps getting pushed due to it being a slight annoyance rather than a critical bug. I'll push the request further up the list.

    GetRow() can be called if you have access to the generated database class itself. It will return the row directly, and is the preferred method for accessing your database. GetGenRow() can be called through the interface class if you are working generically. This was a customer request and not completely necessary unless you have the need to abstract the class.
     
  15. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    2.1.6 Has been submitted to the Asset Store

    Fixed issues with data loss in Object Databases. There was an issue with the rate we were retrieving the information after an assembly reload (When the script compiles and reloads G2U) and submitting data to the Object Database. Instead of relying on Unity to serialize/deserialize the data we are writing the data to a temp file prior to reloading the assembly, and reading it in after the assembly reloads. This ensures the data going into the Object Database is accurate.

    Fixed a bug were export directories would generate regardless of output type. If you export as one type, the only generated directories will be of that type. No more empty directories!
     
    johanneskopf likes this.
  16. WilsonC

    WilsonC

    Joined:
    Apr 27, 2013
    Posts:
    3
    Hi,

    I have imported the G2U 2.1.6 and the following error message while opening tab "Google2u" under Unity 5.3.2 (x86) on Windows 7 x64

    "! Google2u is unable to communicate with Google using this build target. Please switch to either the Standalone or Mobile targets."

    Both G2U 2.1.6 packages submitted using Unity 5.0 & 5.3 I have already tried and have the same error, but it has no problem when I import using Unity 5.0.4 (x86)

    Please take a look with this issue. Thank you very much!
     
  17. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    You should only get this message if you are not on a desktop target. G2U is only allowed to communicate with Google when the Desktop target is selected (This is a Unity Editor restriction, not G2U). Once you have imported your data, there is no restriction on the platform, this is an editor-only restriction.
     
    Last edited: Feb 15, 2016
  18. WilsonC

    WilsonC

    Joined:
    Apr 27, 2013
    Posts:
    3
    Thank Shane,

    Problem solved. The root cause is the new installation method of Unity 5.3 has been divided into parts that some of the components need to be downloaded separately.

    Thanks again
     
    Shane-C likes this.
  19. CrunchingTom

    CrunchingTom

    Joined:
    Mar 29, 2011
    Posts:
    42
    Hey Shane,

    Have you maybe fixed the "VOID thing" in the newest version? ;) Sorry for bugging you on this, but I just don't know if I should download the new version, try it and possibly waste time on this or should I just wait for the fix.

    Thanks for the info in advance!

    Cheers,
    Tom
     
  20. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I have indeed fixed the void column issues. Get the latest!
     
    CrunchingTom likes this.
  21. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    And just like Murphy predicted, more void column bugs were found, and fixed.
    Also fixed an issue where newlines were causing issues in Object Databases.
    Also fixed the Sample scene. I hadn't tested it in a while, and it came to my attention that everything was broken.
    And finally, I removed the sample xlsx in leiu for a different one.. and added a tutorial on how to use it.

    2.1.7 is uploaded to the Asset Store now. It should be available shortly
     
    johanneskopf likes this.
  22. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    52
    That's great, thanks for your ongoing support! :)
     
  23. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Hi
    So far loving the plugin. One question though - I'm not sure whether I should be using an Object or Static database.
    I have multiple game objects on scene that will grab their details from a main game script which holds the database. I've been using object so far, but wondered if I'm better off with static? All the objects are loaded from start of game and not destroyed at any time.

    Cheers
     
  24. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Hi again.
    I have an issue and I know it's probably something very obvious, but I've looked over your samples and the docs and can't figure out what's going wrong. (I'm using Pro version)

    I have a simple spreadsheet with just three rows of data in it for now for testing.
    When I access row one of the data sheet using "ID_Enemy_1", then I can access all the data in that row (HP, Hit, etc) as expected.

    However, when I try to access the SECOND OR THIRD row of data using "ID_Enemy_2" (as per the spreadsheet) I get an error message:
    Code (csharp):
    1.  
    2. ID_Enemy_2 is not a member of the rowIds enumeration.
    3. ArgumentOutOfRangeException: Argument is out of range.
    4. Parameter name: index:
    5.  
    So I don't understand what I'm doing wrong. If I open the workbook on Google2u tab, all three rows are all there. However, if I click on the game object in the scene (Google2uDatabase), and look at the scripts in the inspector on that object, only the first data row appears there.

    I'm grabbing data from the google spreadsheet using:
    Code (csharp):
    1.  
    2. GameObject DbObj = GameObject.Find("Google2uDatabase");
    3. if (DbObj != null) {
    4. _enemyDB = DbObj.GetComponent<Google2u.ENEMIES>();
    5. }
    6.  
    And then grabbing column values for each row in the spreadsheet with, e..g. such as this string value:

    Code (csharp):
    1.  
    2. public tk2dTextMesh txt_TITLE;
    3.  
    4. txt_TITLE.text = _enemyDB.GetRow(ID_Enemy_1)._Title;
    5.  
    6. NB: If I have ID_Enemy_2 instead of ID_Enemy_1, I get the error above.
    7.  
    Also when I check number of rows in the DB it returns a value of 1 instead of 3. No, I don't have any blank rows in my spreadsheet, no spaces in my column headers or ID.

    I have also removed the plug-in and reinstalled. I've also tried using a new and different spreadsheet. Nothing works.


    Hope you can help!
     
    Last edited: Feb 21, 2016
  25. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    The main differences between Static and Object database is how you access them. If you use an Object Database, then you can use the inspector along with public variables to access your database. If you use a Static Database, then you must access everything in the code. Static Database will generate a generic object, whereas Object Database is a Monobehavior.

    There was an issue with 2.1.7. I've since resolved it and uploaded 2.1.8 to the Asset Store.

    This fixes the issue with the Object Database not being able to read past the first row. Apologies for 2.1.7, I should have tested it more thoroughly. I changed the way we are serializing the data, and it should be stable now (I tested all cases this time!)
     
    CoCoNutti likes this.
  26. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    491
    Thanks again for the quick fix!
     
  27. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    425
    Hey Shane,

    Thanks a lot for those previous fixes regarding creating unnecessary folders!

    Something completely different: when I save my sheets as static databases, I need to [alt] + [tab] out and in to Unity before they are reimported and usable. This seems like something that's easily fixed, right? Like... check which databases are to be downloaded, and if they are all done, force to reimport those?
     
    johanneskopf likes this.
  28. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    This should only happen the first time since the classes don't exist in the Asset Database yet. And you can right click -> Refresh instead of alt-tab as well. I'll look into refreshing the asset database on creation of these files.
     
  29. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    It's come to my attention that the Upload functionality isn't working correctly.
    It seems that the Google API I was using for uploading files has either been deprecated, or is having issues.
    Either way, if the problem continues I will have to issue an update temporarily removing the upload functionality until I can find a workaround.

    Regardless, you are still able to upload files manually through the Google Docs site:

    • Open a web browser and go to: https://docs.google.com/spreadsheets/u/0/
    • Ensure you are signed into the same account that you have given access to G2U
    • Click the folder icon in the upper right, just below your user icon
    • Click the "Upload" tab
    • Drag and drop a spreadsheet file into the window
    • Wait for Google to upload and process the workbook
    • Back in G2U, ensure you are logged in and open the Workbooks->Account Workbooks rollout
    • You should see your workbook in the list now
     
  30. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    425
    Well, if I update my sheet, hit the save button in the Google2u window, and play the game, the updated keys are not in the game yet and I get an error. It's when I go in and out of MonoDevelop that Unity registers the update of the (static database) C# files and I have access to the new stuff in game.
     
    johanneskopf likes this.
  31. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I'm looking into the Upload issue right now, as soon as I determine an acceptable solution for the problem I'll update the Asset. Along with that update I'll see if I can manually refresh the asset database when you export the other types as well, that should be a really simple fix.
     
    Last edited: Feb 25, 2016
    johanneskopf likes this.
  32. Cence99

    Cence99

    Joined:
    Apr 14, 2013
    Posts:
    39
    Hello,

    For developing a mobile game, is loading multiple different sheets a big factor on performance? I am using Object Databases and getting the script components via code to access the data. I have multiple sheets (5+).

    As performance is a big factor on mobile, is there eventually a more efficient approach?

    Thanks in advance
     
  33. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hello,

    I just started using this and I like the ease of setup so far. The problem I have is that I am trying to use Playmaker but no options come up to export Playmaker actions. I have Playmaker in my project, can you help in figuring this out please?

    Thanks,
    jrDev
     
  34. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    While the memory requirement depends on the size of the sheets themselves (And it takes a lot to make any kind of impact), the performance to look up the data in 5 different sheets is almost unnoticeable when profiling.

    Essentially, the Object Database stores all the data into a game object, and the scripts that are attached facilitate retrieving that information by direct lookup. It's really as simple as that.

    Playmaker Action generation requires the Object Database. The option to export Playmaker Actions is in the Object Database settings, accessible when opening up the full sheet view.
     
  35. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey,

    That worked!

    Another question, is there a recommended way to build my game where I can access updated GoogleFU information through a server so anytime player opens app they get any updates I made in my google docs spreadsheet. Are asset bundles the way to do this?

    Thanks,
    jrDev
     
  36. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    G2U is an editor only extension. There is no provision to contact/access your information from Google during gameplay.. it's all a pre-build process.

    The reason for this is two-fold. One, it would require libraries specific to your platform target to be included with the build, or use a different protocol entirely to access the Google doc. And Two, it would require you to bundle Google credentials to access your document, which is a security risk.

    All that being said, perhaps in the future we can figure out a solution for runtime access, as Google has updated their API to work very differently than the one we have implemented. But for now we do not intend to implement any sort of runtime access functionality.
     
  37. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Ok, I re-read your question, and I may have mis-interpreted it.

    The JSON export option is probably what you are looking for. G2U will create both the JSON object in a file, as well as the class that you need to use to load it. It will take some custom scripting to access a webserver, but once you have the object loaded you will be able to use it in game. Unfortunately there are no Playmaker action bindings for accessing a JSON object that I know of, so you'd have to write those actions yourself. The only Playmaker actions that G2U will provide are ones to access a Game Object database.
     
  38. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey,

    Ok, thanks. I was slightly asking also what web server is recommended if you have any idea working with stuff like this.

    EDIT: Would the XML export be an option too?

    Thanks,
    jrDev
     
  39. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    How far into the future? :-]

    Something like this. http://gdeonline.solutions/#/#gdeonline-plans

    Thanks,
    jrDev
     
  40. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    It's all going to depend on the scope of your game.

    If you are talking about a dozen or so values on a single sheet that players sync once during the game load, then you could probably get away with a cheap shared webserver solution (with a redundant server or two for backup). This is by far the cheapest solution, but it wouldn't be able to handle a ton of traffic. If you are planning on doing a serious game, then Google or Amazon both provide a much more reliable service.. for a price.

    I'd recommend JSON over XML. Sure, the XML is prettier and easier to edit after export, but JSON is the same amount of information in a smaller file, therefore less information to transfer. Believe me when I say that every byte counts when you are talking bandwidth usage.

    G2U is designed to assist in creation of the game by using a data-driven approach. Balancing stats, localizing, etc. It was never intended to be used as a live database. While the different export options exist for flexibility, online hosting and cloud based data solutions are simply out of scope for the utility.
     
  41. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey ShaneC,

    How feasible would it be to add an Object type to be read from, for use obviously only in Unity? If you can't do it, can you point in the direction of the script used to build object scripts?

    Thanks,
    jrDev
     
  42. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I'm not sure what you're asking for with this one. Do you mean to look up a GameObject? "GameObject" is a valid type, but internally all it does is look up the GameObject by the string name using *shudder* GameObject.Find( stringName );

    I highly recommend you implement your own lookup utilizing plain strings, and loading prefabs. It's really difficult to make that generic enough to put into G2U, but if you wanted to streamline it, the Google2uObjDB.cs file contains all of the export logic for Game Object Databases. It's... a bit rough to look at, considering it's one big code generator.

    If I've completely missed the mark here, I request that you give a specific example of what you are attempting to accomplish.
     
  43. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey,

    What I wanted to do was to just have the Object type (not Gameobject) be matched up with a sound file to access directly from GoogleFu. I would build a script that would be able to pre-fill the matching Object field with the sound file.

    Thanks,
    jrDev
     
  44. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey Shane,

    Any answers?

    Thanks,
    jrDev
     
  45. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Sorry jr, It's been a rough few days at work actual.

    I think I understand what you're after. You can make an "object" type, but g2u wouldn't be able to pull any binary data from Google, so you'd have to set up a sort of lookup and replace to get object data into the final database. Either way this is a very custom use case and it would be best to resolve it via email since this thread doesn't notify me of updates. contact@litteratus.net

    Shane
     
  46. jrDev

    jrDev

    Joined:
    Nov 5, 2008
    Posts:
    1,674
    Hey,

    No problem, I know the feeling. I emailed you.

    Thanks,
    jrDev
     
  47. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    After g2u exports csv files, Unity don't recognize new files.
    User should press Ctrl + R manually for refresh unity.

    Suggestion :
    Please call AssetDatabase.Refresh() after export done.
    It would be better if g2u have event(delegate) for notifying export completed.
    If so, g2u users can make their code to detect new data and process it automatically.
     
  48. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I like this idea
     
    johanneskopf likes this.
  49. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I made a small update in 2.1.9 that should refresh the asset database whenever you export.
    It's available on the Asset Store now
     
    johanneskopf likes this.
  50. netics

    netics

    Joined:
    Aug 23, 2011
    Posts:
    102
    Thank you!