Search Unity

[RELEASED] Google Sheets For Unity Lite

Discussion in 'Assets and Asset Store' started by Novack, Mar 3, 2014.

  1. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Gotcha!
     
    Victor_Kallai likes this.
  2. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Novack One more thing, would it make sense to add the ability to compress/encode the requested JSON? And decompress it locally with some 3'rd party plugin or with GSFU. Let me know what you think.
     
  3. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hey Victor, Sounds interesting, what exactly you mean? Encoding or compressing? What would be the purpose, corruption safety, encryption, or reducing data size?
     
  4. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    I was thinking about reducing the data size and make the call bit faster if you have a lot of data in the spreadsheets. I'm not sure if it is worth it, though. Read this for more info: http://mainroach.blogspot.ro/2013/08/json-compression-transpose-binary.html The cost of decompressing might be higher than what you would gain from compressing the json.
    The best way to settle this is to test it, so that's what I'm going to do in the next couple of days, if I have the time. I haven't decided which is the best way, just gzip the json first, send it and decompress it locally? Or use bson for compression?
     
    Novack likes this.
  5. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hey, that looks like an excellent read, thanks for the link.

    I guess it really depends on the size of the downloaded data, that being plain text is really hard to get to a relevant size which deserves compressing... is not a bad idea to have the option though. I may need to read more on that as well.
     
  6. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Google Sheets For Unity 2.0 submitted to the Unity Asset Store!
    u3d.as/6Lk
    ‪#‎refactored‬ ‪#‎improved‬ :)

    Expect news for its aproval and public release in the coming days!
     
    Victor_Kallai likes this.
  7. jrDev

    jrDev

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

    I am looking into using this in projects. Are there any playmaker actions to use?

    Thanks,
    jrDev
     
    Novack likes this.
  8. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello jrDev, Im afraid there is no integration with Playmaker. So far GSFU was more like a working principle than a concrete imlpementation of a use case, so creating something for Playmaker was kind of hard given the abstract nature of this extension.

    Now though, with Google Sheets For Unity 2.0, it may be more feasible, given it noe includes a concrete API for simple cases. It is among the posibilities to work on such feature, but in the mid/long term.

    Thanks for your interest!
     
  9. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Google Sheets For Unity 2.0 is up!​

    • Completely refactored.
    • Moved to the new UnityWebRequest api, leaving behind the WWW class.
    • Replaced LitJson with the new Unity JsonUtility api.
    • Implemented a small, simple and clean API: simple CRUD operations between Unity and Google Spreadsheets is now posible out of the box.
    • Complete Developer Guide rewrite.
     
    chelnok and Victor_Kallai like this.
  10. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    300
    This looks interesting,
    Could I use a local spreadsheet file as an alternative source(xls,cvs or something)?
     
  11. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello sfjohansson. GSFU is for two way connectivity from Unity to online Google Spreadsheets. You could use whichever type you need as local storage, but would not be directly related to this asset.
     
  12. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Some notes regarding V2.0.

    Some people is reporting surprise when looking at the new version: just 3 files.

    To clarify: this is not an update, is a whole new version (thus the emphasis on, "2.0") and those 3 files are all the actual content of the package. It will not update v1.5 with changes, but use a different folder.

    Google Sheets For Unity has been always minimalistic in nature, and I have worked on taking advantage of some new Unity features to improve and polish that.

    Version 2.0 is a comple rewrite that while gaining new functionality (like a new API for basic needs), improved many aspects of the asset (removed dependencies, moved to new Unity classes, using POST method, rewrited the webapp, etc). There are some non-central features of previous versions absent (an editor use example, connection password example), these are going to be added on further point releases.

    As usual with any software update, in your development project you need to measure the benefits of importing a new version, with the risks and costs of the changes required.

    In any case, I recomment to download and import GSFU v2.0 on an empty project, understand how it works, have the new demo working, take a look at the Dev Guide pdf, and only then consider including it on your workings projects and begin any necessary port.
     
    Victor_Kallai likes this.
  13. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    61
    Novack, may I please have a link to a working copy of the google web script? The link you provided in your documentation is broken and I couldn't get the backend server setup without it. Cheers!
     
  14. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hi @ldhongen1990
    The link is not broken, I have checked it. So this tells me that you are using a previous version of the asset.

    If you have further issues, please contact me through the support email with the invoice number.
    Thanks!
     
  15. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    So, with all the back and forth of Unity forum changes, some posts got lost from our thread here.

    I will summarize some important info:

    • Google Sheets For Unity 2.0.1 has been released on the UnityAssetStore - Please update: u3d.as/6Lk
    • Also, please have in mind that Google Sheets For Unity requires fixes present on the latest stable Unity3D version (5.3.5f1).
     
  16. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Attention fellas. A user is reporting an issue with version GSFU 2.0 on iOS:

    In a gadget running iOS version 9.3.2, retrieving data from the spreadsheet works in GSFU 1.5, whereas it will return a 400 ("Bad Request") response code in GSFU 2.0.

    It may come to either something related to iOS handling of POST requests, or worst, an issue in the UnityWebRequest class (which has suffered a few already...).

    I will be working on tracking down the problem, but please if any of you happen to watch the thread and work with GSFU on iOS, chime in and let us know who its going!
     
  17. sirnameless

    sirnameless

    Joined:
    May 15, 2014
    Posts:
    8
    Hello, I sent you a support email, but I figured I'd post here too. :)

    Is there any way I could receive a version of "Google Sheet for Unity 2.0" that would work on Unity 5.2.4? I'm unable to update to 5.3 for my current project.

    Thank you.
     
  18. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello there, I was just answering your email.
    I will repeat here for public reference:

    GSFU 2.0 uses UnityWebRequest Unity api class, which received critical fixes recently, so although I think it should be feasible to use the asset on previous Unity versions, I would strongly advise against it.
     
  19. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello people, a quick post to announce some new issues found on the Unity API. As before, UnityWebRequest class is showing some lack of maturation. For all issues, I created bug reports.

    Case 814388. UnityWebRequest on iOS: POST requests do not always work (even when the same request works fine in other platforms). This one has been confirmed by the Unity QA team, and can be found on the public issue tracker, here.

    Case 814458. UnityWebRequest fails to create a POST request with the dictionary<string, string> method, if the payload surpasses 24Kb.

    Case 814110. Mistakes on the documentation of the UnityWebRequest class, using the same example for different method overloads.

    On how to temporarily bypass this problems:

    To bypass issue 814388 you can move to GET requests where possible. This is far from ideal, has its limitations and also requires changes on the webapp driver, but its for those cases that cannot wait for Unity to fix the issues.

    To bypass the issue 814458, you can use WWWForm (although the docs mention this helper class as "legacy", there is no clarification regarding if its going to be deprecated at some point, as it was designed for the WWW class which is being deprecated).
     
    Last edited: Jul 21, 2016
  20. Totee

    Totee

    Joined:
    Jul 24, 2016
    Posts:
    2
    Hi!

    I've just bought the GSFU asset, it was easy to integrate and works very well in Unity Editor. However I deployed it to Android and iOS devices and it doesn't read data. It able to update, but doesn't read. Does this problem related to the issues above? How about Android, is there any problem with POST request also on that platform?

    Thanks in advance!

    PS: I'm using Unity 5.4.6f1.
     
  21. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hi @Totee

    I'm not sure the status of Unity Beta so I can't say for sure it should work on it or not. I have confirmation of this issues happening on iOS, but not yet investigated on Android.

    Would like to investigate this further, if you can, contact me by email.

    Thanks for reporting!
     
  22. Totee

    Totee

    Joined:
    Jul 24, 2016
    Posts:
    2
    Hi!

    Thanks for the quick response! Is there any Unity version, where this asset works for sure on iOS?

    Thank you very much!
     
  23. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    There were a bunch of related or similar issues that got me on hold with the release of v.2.0. As those issues were fixed, it seemed like the new Unity 5 API gained stability and so the new version of Google Sheets for Unity uses UnityWebRequest class. But now, field use seems to indicate the new Unity API is still unrealiable.

    I can't say for sure if this new issues were introduced recently on any of the patch releases, or lived there from the begining, there are simply too many versions to test.

    At this point, I think the safer bet for making it work with iOS is to roll back the use of UnityWebRequest API to the old WWW class.

    GSFU centralized the web request creation for all operations in one simple method called ExecuteRequest(). That is the place for making the required changes. If you need help with this, please do contact me by email, do not discuss technical or code details here.

    Thanks!
     
  24. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    578
    I need to get data from a previously made Google Sheet. Is there a way to plug in an address and get the data? Right now I'm loading a list of coordinates from a scriptable object in the Resources folder, but I want to create a Google Sheet, be able to edit it through Google Drive, and read from it in my application. If this isn't built in, would it be hard to extend your asset to get it working?
     
    Novack likes this.
  25. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello there @keenanwoodall,

    What you describe is perfectly feasible using GSFU. If you follow a very simple layout for your spreadsheet (first row for headers) you can do it with out of the box functionality. If you need a specific layout you may need some tweaking, but in general terms, is a simple "Yes" :)
     
    keenanwoodall likes this.
  26. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    578
    I'm trying to grab numbers (for latitude and longitude) but the JsonHelper is saying that all they are all zeros. Where should I be using Float.Parse?
    EDIT:
    It is correctly retrieving the name of the locations, but I guess that makes sense.
     
  27. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Well, your question is really vague considering I dont know anything about your project or spreadsheet setup. Please contact me by email for personal support. Thanks!
     
  28. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Good news for all guys and lads here!

    Working with the Unity QA Team, and specially thanks to @christophergoy, we have a workaround for the iOS POST request issue described above, and reported as Case 814388. This should work just fine until the actual fix be available in a patch release.

    In the WWWConnection.mm class in your Xcode project look for the function UnitySendWWWConnection. In that function you'll see a condition where body data is being added to the request. It is being added to the GET request after the redirect which is causing the server to reject the request. If you add a check for the type of HTTP Method being used we should get the expected result.

    Code (CSharp):
    1. if (![request.HTTPMethod isEqualToString:@"GET"] && data != nil && length > 0)
    2. {
    3.   [request setHTTPBody:[NSData dataWithBytes:data length:length]];
    4.   [request setValue:[NSString stringWithFormat:@"%d", length] forHTTPHeaderField:@"Content-Length"];
    5. }


    Edit: For Android builds, we still need to rollback UnityWebRequest class calls, to the legacy WWW API calls.
     
    Last edited: Aug 9, 2016
    Victor_Kallai likes this.
  29. BenouKat

    BenouKat

    Joined:
    Feb 29, 2012
    Posts:
    221
    Hi !

    I got a problem on Android, everything works on Editor, or a Windows build, but when I run the app on Android and try to do a GetTable, it fails with "Undefined server response" and the debug xml displayed is :

    It's in french but it says "Google Drive : Page not found".
    Does anyone faced this issue ?

    I set my script in "Anyone, even anonymous", I also tried to set the script and the sheet in public mode, it doesn't change. And again it works on PC both on Editor and build.

    I use Unity 5.4.0f3.

    Thanks a lot !


    EDIT : I used old WWW classes, it works now. :) But nothing seems to be fixed Unity team side about the new classes even in 5.4.0f3.
     
    Last edited: Aug 9, 2016
  30. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello @BenouKat!

    Sorry for the inconveniences, but Im glad you found the way to make it work.
    Yours, adds to the recent reports that the issue described in the post above yours, happens on Android as well. We'll have to have patience until the fix is included in the next patch release, so you can come back to the new UnityWebRequest API. In the mean time, WWW should do just fine!
     
  31. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Novack Hello, I wanted to ask if you plan to add in the new version the password feature. I haven't switched to the new version yet because of this, I consider critical to have some kind of basic protection, given the fact that anyone can use the deployed scripts and modify our spreadsheets, with no restriction. Thanks!
     
    Novack likes this.
  32. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hello Victor!

    Yes indeed I plan to add it on the next version. I neglected that feature as it was simple enough to redo, or to port from the previous version (or even a hardcoded pass, for that matter, would be very easy to implement). However it seems that I subestimated the importance given to it by the people using the extention, as yours is not the only request around that feature.

    Have in mind though, that the URL of the webservice (if using the settings described in the manual) is only known by the developer and the app, Google wont make it public, so its not really overexposed.

    Rest assured, I will have it included in the next update... can't say when it will be out though :/
     
    Victor_Kallai likes this.
  33. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Some good news!

    I have been working on optimizing the GSFU v2.0 server script, and obtained some substantal improvements on data retrieval performance!

    This has been a high priority for me since v.2.0 release, as after the webapp refactoring, having a sizable number of rows resulted on horrible data retrieval times.

    Now -using a DSL connection- the GetAllTables query, on a spreadsheet with 3 worksheets of 1000 rows each, and each row having 4 fields (12000 cells in total), got varied return times of always under 4 seconds.

    The script is online, just follow the manual and get a new copy!
    If you happen to have cutomized your webapp code, and cannot simply replace it, the relevant changes are in TableToObjectArray and ParseGetObjects functions.

    Regarding the mobile issue described the past weeks: regreatably, the latest Unity patch release does not yet include the fix for it, but I'm crossing my fingers for the next week.

    Will keep you posted!
     
  34. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hey people, news update.

    Before the end of august, I will be releasing an update for GSFU.
    It will include password protection, and the Unity Editor implementation as the 1.x version used to have. This should bring the asset to a feature parity with the original release cycle, plus all the improvements of 2.x

    Also, I will be including an extra, refactored version of the method using UnityWebRequest API class. Unity dev team is taking too long to deliver the fix for the iOS/Android issue that is pestering us daily, so I have decided to offer myself the backport to the WWW class that would temporarily solve the problems we face with the new Unity API. It will be temporary, as Unity will deprecate WWW class in the near future, but should buy us time at least until they provide a patch release including the bug fix.

    So please pay attention the next few days to this thread, twitter or facebook, I will be announcing the update as soon as it is up for downloading.

    Cheers!
     
    Victor_Kallai likes this.
  35. Victor_Kallai

    Victor_Kallai

    Joined:
    Mar 5, 2014
    Posts:
    123
    @Novack Not all heroes wear capes. Thank you!
     
    Novack likes this.
  36. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    LOL, Thanks to you!
     
  37. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Reporting about the progress on the works for the incoming update.

    Regarding the workaround for the iOS/Android issue, yesterday I lost valuable time writing and testing an implementation using POST requests with the old API (the WWW class), only to found (or rather, remember) that the old class is *also* plagued with issues, like the fact that POST requests are not followed correctly either (!!!), and whats worse, it cuts off the "Location" header from the response (and any header that comes after it!!) so I neither can follow the redirection manually...

    Sooo. That brings us back to only one option for a patchy workaround, which is to use GET requests. This is far from ideal, for the very limited amount of data that a GET request can hold in comparison to a POST. This means the workaround will work as long as the data sent be limited in size, which ensures that you will be able to fetch data without issues, but sending data will be limited to a few Kb per call until Unity fixes the UnityWebRequest class.

    Now the nice part, is that speaking of the new API class, the GET request does not suffer from the issues found in its POST counterparts, so we can perfectly use the newer UnityWebRequest class for it. The result, is that I am considering simply adding the posibility to pick one type of request or another (as a feature), and you could simply switch back to POST as soon as Unity fixes the issue.

    So the workaround for this issue will end being a new feature for the asset.

    Stay tunned, hopefully in the next few days I will be back with news!
     
    grimmy likes this.
  38. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    Hi @Novack

    I imported the new v2.0 in my new project. Then I deployed on client and server side as per the PDF.
    I've got problem running the demo.

    First it returns



    After the following subsequent runs, it returns

    I've used the 1.x version on my previous game and it works good.
    I'm running on 5.3.5f1. Tested on the editor for Android and PC.
     
  39. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Hey there @ikazrima

    That is because I have been implementing some changes on the server side script, for some upcoming changes on the asset. Please contact me by the support email, and I will help you improve the situation. Have in mind to update to latest Unity release first though. Sorry for the inconveniences.

    Cheers!
     
  40. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    For now it's not critical, I think I can wait a bit until you settle the issues.
    I'll contact you if needed to, thanks!
     
    Novack likes this.
  41. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    396
    How's it all going Marcos? I am waiting impatiently for this update ;)
     
    Novack likes this.
  42. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Still under the original premise, before the end of august ;) :D
     
  43. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    396
    Nice! :D
     
  44. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Aaaand is up!

    Google Sheets For Unity Version 2.2.1
    is up for downloading.​

    Changelog:
    • Refactor to include in-editor example.
    • Password protected access.
    • POST / GET Request option. (using get will work as workaround for issue 814388)
    • Extended developer guide to accomodate new features.
    • Server script updated for highly increased performance. (released prior to official update).

    There some structural changes so as usual, please import and test on an empty project first. Also, please read the manual. Also I got reports that the Unity asset importer may do tricky things if you update the asset, so remove the previous version before import (with the obvious precautions on live production projects).

    The examples are now two, the original for runtime games, and a new one for in-editor use. To avoid code duplication I created utility classes that can be used for both cases, so there are more files in the asset now.

    Finally, regarding the dreadful iOS and Android issue, tracked as 814388: using GET for requests (now a feature as enumerated above), will work as workaround but have in mind that GET requests have really low capacity for sending data, ranging from 2kb to 8kb on some cases. Use with care!

    It required a lot of work to get it done as I wanted, but I think is well worth it. I hope you guys find it useful, its getting quite an interesting tool.

    Cheers!

    PS: on my time zone is still august for TEN more minutes :p
     
    Last edited: Sep 1, 2016
    Victor_Kallai likes this.
  45. CraigGraff

    CraigGraff

    Joined:
    May 7, 2013
    Posts:
    41
    The GSFU_Demo_Runtime.cs file has a class named GSFU_Demo inside it, meaning it can't be used as a component. (Minor problem, but I thought you might like to know.)
     
  46. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    Thanks @CraigGraff but is not really what I have. And I can't imagine how that could happen (that you and I have different contents on the same file)?
     
  47. CraigGraff

    CraigGraff

    Joined:
    May 7, 2013
    Posts:
    41
    Ah, apparently a slight (and weird) Unity bug. When I import into an empty project or clear out the old version first, it imports correctly. But if I leave the old version in and import the updated package it replaces the file contents but doesn't rename it (I reported the problem backwards, apparently).

    Not your bug, in any case.
     
    Novack likes this.
  48. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    That is good to know in any case! Thanks mate for the heads up, I will add a comment to the post.
     
  49. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    691
    I got a report of developers having building issues. This is because scripts using UnityEditor namespace are not there for inclusion on game builds. This was rather obvious for me while working on the asset, but is not so obvious for a developer that wants to build and unhappily finds that he needs to apply changes to undesired script guests in order to have the build done.

    I submitted version 2.2.2, which basically encloses editor related scripts in conditional compilation statements, so builds are not interrupted any more courtesy of GSFU.

    Is up for update!
     
    Victor_Kallai likes this.
  50. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    Hey @Novack
    I got "'UnityWebRequest' could not be found" in v2.2.2 and Unity 5.3.5f1.
    Clean project btw.

    edit : changing to Experimental.Networking works I guess :)
     
    Last edited: Sep 5, 2016
    Novack likes this.
unityunity