Search Unity

Load images and text data from external source, Google Drive

Discussion in 'Scripting' started by ksc_3899, Jul 9, 2019.

  1. ksc_3899

    ksc_3899

    Joined:
    Jan 1, 2019
    Posts:
    30
    I am building a game which needs to load images and text from my Google Drive.

    Can anyone help me with the required resources? Any documentation or video tutorials?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    I think there might be webdav plugin for unity somewhere.
     
    ksc_3899 likes this.
  3. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    ksc_3899 likes this.
  4. ksc_3899

    ksc_3899

    Joined:
    Jan 1, 2019
    Posts:
    30
    Can you name any if you've worked with?? And also, my target platform is Android. So that shouldn't be a problem.
     
  5. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    I started with Google Sheets for Unity and that works rather well. I ended up extending his approach to support additional file formats, an advanced authorization system, multiple sheets within a document, multiple documents, etc, before eventually moving to my own server APIs (where I had more control) and away from Google Drive entirely. Some of that is probably included in his asset now- I used it back when it was just a fledgling thing, and I still found it quite valuable. I think it's worth the money for that asset just to get the instructions on the setup process, which requires creating a script to run in Drive in order to accept and process the HTTP requests.

    And if you need help with it, he was always very responsive on the forum back when I was using the asset- and I'd be willing to help out as well. I don't really feel comfortable giving out my own code for this though, since it was technically built with one of his earlier releases as a base before all of my modifications/extensions. I think I even changed it to a non-MonoBehehaviour service last time I edited it too (it's been awhile) so it wouldn't easily slot into a Unity project that doesn't use a service locator anymore, regardless. Apologies.

    That said, you can learn to do it yourself and save the money if you don't mind digging around into Google Apps Script. Accessing an API through an Apps Script app is identical to http requests everywhere else, so there should be a ton of information around on the Unity side of making the service to connect and retrieve JSON data over the web.
     
    Last edited: Jul 10, 2019
  6. ksc_3899

    ksc_3899

    Joined:
    Jan 1, 2019
    Posts:
    30
    So can I be using WWW class of Unity to get things done even with Google drive?
     
  7. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    The Apps Script application is like javascript and gives you the ability to generate something like an API, accessible with an address and fed parameter values just like any other API. So yes, if you get the app set up and running on the Google Drive side, you can use WWW to access it and pull data.

    Here's the Web App page of the Apps Script documentation, which should give more information on setting it up on that side. It takes some reading and some setup time, but it's not particularly complicated or difficult as long as you're willing to devote an hour or two to it.