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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Google Drive SDK for Unity (free, open-sourced)

Discussion in 'Assets and Asset Store' started by Elringus, Feb 1, 2018.

  1. m_wasim_bashir

    m_wasim_bashir

    Joined:
    Oct 2, 2012
    Posts:
    25
    @Elringus i download package as in doc , am already using Newtonsoft that was the conflict between them i deleted mine after deleting .dll facing this exception "Assembly has reference to non-existent assembly 'GUID:26c3782e36cc1874587ef07692accab2' (Packages/com.elringus.unitygoogledrive/Editor/Elringus.UnityGoogleDrive.Editor.asmdef)
    "
    Which assembly is missing ? I imported complete package.
    And what is that mean in package.json
    "lock": {
    "com.elringus.unitygoogledrive": {
    "hash": "fcdab032f47a108db528c618fd2d5ba98d9fd652",
    "revision": "package"
    }

    why you are finding package with GUID ?
    using unity 2018.4.9 LTS
     
    Last edited: Sep 23, 2019
  2. Jerrymev11

    Jerrymev11

    Joined:
    Mar 1, 2017
    Posts:
    9
    Now im getting a failed to execute authorization procedure. Check application settings and credentials. Any idea what i might need to change?
     
  3. mrthang

    mrthang

    Joined:
    Jul 31, 2016
    Posts:
    3
  4. mrthang

    mrthang

    Joined:
    Jul 31, 2016
    Posts:
    3
  5. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    482
    Can't really tell what's wrong without seeing the logs, but most likely the google app is misconfigured in some way.
     
  6. greay

    greay

    Joined:
    Mar 23, 2011
    Posts:
    88
    I have one issue that's been a huge pain to troubleshoot: if you begin the auth process in the editor, but cancel out of it, the editor remains locked up & you have to force-quit it.

    It works fine on Android – if you cancel out, it returns you to the app & everything behaves. But completely locking up the editor is something I'd definitely like to fix.
     
  7. jsleek

    jsleek

    Joined:
    Oct 3, 2014
    Posts:
    61
    Hi there,

    Is it possible to use this plugin to create and upload a Google Doc via Unity?

    Title,description, images, bold font etc.
     
    Last edited: Feb 4, 2020
  8. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    482
    Yes, it's possible.
     
  9. SparkleBoom

    SparkleBoom

    Joined:
    Nov 10, 2017
    Posts:
    3
    Hi there,
    I'm try to use this as a tool for game dev at school.
    For now, my app upload every kind of file.
    But if I want to download them I need to specify an extension.
    There are any method like the upload one to avoid this check?
     
  10. mohr_weng

    mohr_weng

    Joined:
    Mar 15, 2019
    Posts:
    2
    Hi,
    when I clone the directory to the package manager these are all I get :
    upload_2020-4-7_22-39-43.png

    It looks like there is supposed to be a unity Google drive package from the readme ... did I miss something else I need to download?
     
  11. samyoed

    samyoed

    Joined:
    Dec 11, 2017
    Posts:
    2
    Has anyone been able to figure out how to get this working on the Oculus Quest? I read a few comments back that people were also having this issue but I was wondering if anybody was able to resolve them. At the moment, inside Unity, it sends me to my default web browser to authenticate. However, when I try to get it to work for the Oculus Quest, it sends me to my web browser but closes the original app. Returning to the app will require me to authenticate once again, not doing anything.
     
  12. ZerotheLone

    ZerotheLone

    Joined:
    Nov 9, 2017
    Posts:
    16
    Hello Elringus,
    I have a bug I haven't been able to fix yet.
    On IOS devices the dialogue box that pops up and tells you your about to be re-directed pops up and immediately goes away. It works fine on android though, the dialogue pops up and stays up until interacted with. It also redirects just fine from the editor in windows and macOS.
    Any idea what might be causing this on iOS/ipad?

    On my iPad I'm running version 13.3.1.
    Unity 2019.3.1.12f1

    Thank you.
     
  13. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    228
  14. JosephSutcliffe

    JosephSutcliffe

    Joined:
    Apr 9, 2018
    Posts:
    22
    @Elringus

    Hi there, this may be a dumb question, but, I guess that to download a file from google drive I need to specify the ID of that file through Unity. How can I find out the ID of my google drive files?
     
  15. Apaghost

    Apaghost

    Joined:
    Oct 8, 2019
    Posts:
    3
    Hello,
    I'm trying to get folder's names below a file. I used the "Parents" instruction but get an error when i'm reading the List of <string>. I don't know what i'm doing wrong, or if this part really works? Any suggestions would be much appreciate.
     
    Last edited: Aug 20, 2020
  16. Apaghost

    Apaghost

    Joined:
    Oct 8, 2019
    Posts:
    3
    request.Fields = new List<string> { "nextPageToken, files/*" };
     
  17. GamerTobbe

    GamerTobbe

    Joined:
    Apr 4, 2019
    Posts:
    22
    can you please describe your steps? I can upload -> find file -> download -> saves to local disc -> file is there but only a small 80kb (broken file due to download restriction). When i copy my link it wont give me access to the download pass via browser.
     
  18. ReyJoy

    ReyJoy

    Joined:
    Mar 11, 2020
    Posts:
    2
    Is it possible to download the spreadsheet file and get the result as Csv?
     
  19. IonutDragan

    IonutDragan

    Joined:
    Mar 20, 2018
    Posts:
    2
    Hello! I need to update Permissions on one of my files (I need to share a file), how can I do this?
     
  20. Janibasha

    Janibasha

    Joined:
    Mar 7, 2017
    Posts:
    8


    Is it possible download google drive folder in unity webgl? Drive folder ma have files , images. I want to download drive folder directly to my resources folder. i tried google drive SDK which is not documents not well.

    Please tell me is there any documentation about google drive SDK with unity? I tried but getting port error.

    Confused setting at uri and URLs in creating project.
     
  21. Janibasha

    Janibasha

    Joined:
    Mar 7, 2017
    Posts:
    8


    Is it possible download google drive folder in unity webgl? Drive folder ma have files , images. I want to download drive folder directly to my resources folder. i tried google drive SDK which is not documents not well.

    Please tell me is there any documentation about google drive SDK with unity?
     
  22. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    upload_2021-4-10_16-0-28.png Hi guys,anyone have an idea how I can get download progress from this?
     
  23. artemiys930519

    artemiys930519

    Joined:
    May 17, 2018
    Posts:
    8
    Join the question. How change permission for the uploaded file?)
     
  24. artemiys930519

    artemiys930519

    Joined:
    May 17, 2018
    Posts:
    8
    solved the problem

    Code (CSharp):
    1.  
    2. // id - its Upload file id
    3. public IEnumerator SetPermission(string id)
    4.     {
    5.         UnityWebRequest www = new UnityWebRequest("https://www.googleapis.com/drive/v3/files/" + id +
    6.                                                   "/permissions?key=[Secret Key]");
    7.         www.method = "POST";
    8.         www.timeout = 2000;
    9.         www.SetRequestHeader("Authorization", "Bearer " + AuthController.AccessToken);
    10.         www.SetRequestHeader("Accept", "application/json");
    11.         www.SetRequestHeader("Content-Type", "application/json");
    12.         var dataToSend =
    13.             Encoding.UTF8.GetBytes(JsonMapper.ToJson(new FilePermission {role = "reader", type = "anyone"}));
    14.      
    15.         www.uploadHandler = new UploadHandlerRaw(dataToSend);
    16.  
    17.         yield return www.SendWebRequest();
    18.     }
    Need some library to make json object, and secret key from personal account,
     
    IonutDragan likes this.
  25. EgorZhilin

    EgorZhilin

    Joined:
    May 12, 2021
    Posts:
    1
    Hello, how to download files from GDrive. I don't have them saved anywhere.
     
  26. TonismoGames

    TonismoGames

    Joined:
    Jun 12, 2018
    Posts:
    109
    There is a demo in the package
     
  27. pixeledgamedev

    pixeledgamedev

    Joined:
    Jun 21, 2021
    Posts:
    1
    Hey Elringus, I want upload a file that is already created, do you have any ideas for that
     
  28. wengyhong

    wengyhong

    Joined:
    May 19, 2021
    Posts:
    6
    I received an email regarding there would be an update to the Google Drive API on September 13, 2021. Would the plugin be updated accordingly?
     
  29. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    135
    Hello, Im trying to download a file to specific path and print its name, but cannot make Fields work with DownloadRequest, any help?

    Code (CSharp):
    1. DownloadFile(string id){
    2.     DownloadRequest downloadRequest = Download(id);
    3.     downloadRequest.Fields = new List<string> { "id", "name", "fullFileExtension" };
    4.     //downloadRequest.Fields = new List<string> { "id, name, fullFileExtension" };
    5.     //downloadRequest.Fields = new List<string> { "files(id, name, fullFileExtension)" };
    6.     downloadRequest.Send().OnDone += PrintDownloadResult;
    7. }
    8.  
    9. PrintDownloadResult(UnityGoogleDrive.Data.File file)
    10. {
    11.     Debug.Log(file.Name + file.FullFileExtension); // Both of them are null  
    12.     File.WriteAllBytes(file.Name + file.FullFileExtension, file.Content);
    13. }
     
  30. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    723
    Sorry if this has already been asked, but does this package do what it seems and allow you to download files from Google drive uploads? I want to download an obj file and i'm not 100% on how I would go about it, it seems Google drive doesn't give you a reference to the file itself, but a page that lets you download it. Does this package solve that problem?
     
  31. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,444
    Fantastic plugin, has anyone else had issues on IOS only when uploading files to folders? I am using the folder id and saving a new file to the folder + also overwriting an existing file in the folder, but only the overwriting of a file in the folder works, making a new file seems to dump it to the root of my google drive with the filename 'Untitled' rather than the folder specified.

    This all works totally fine in the editor but on IOS it glitches out.

    The same happens if I try to copy a file using the APIs on IOS, just copies the file but renames it 'Untitled' and poops it out in the root of my Gdrive rather than the folder it was living in.

    https://github.com/Elringus/UnityGoogleDrive/issues/95
     
    Last edited: Apr 13, 2022
  32. GameTimeTl

    GameTimeTl

    Joined:
    Mar 8, 2022
    Posts:
    5
    I don't quite get it and I can't find any tutorials, so how do I list public(shared as Everyone who has link) files from a folder
     
  33. AXVIII3

    AXVIII3

    Joined:
    Oct 21, 2021
    Posts:
    3
    Hello... I am using a Service Account in the Google Console to store some game files for my launcher... How would I authenticate the service account with the API to download the files?

    I am trying to achieve something similar to this but the Google Drive API isn't compatible with Unity by default...

    Also do you happen to have a discord account or any other social media where I can contact you?
     
  34. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    63
    Hello, plugin works great for me. Just want to know if there is a way of telling if a file is a Google Doc or a Google Sheet. I can filter other drive files by their extensions but Google Doc files just have a name?
     
  35. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    63
    Ok I've just fixed my issue needed to add mimeType to my list of fields
     
  36. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    63
    Hey does anyone know if it's possible to get page number information from exporting content from a Google Doc file. Would like to know when a new page is started.
     
  37. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    228
    Unity Google Drive is abandoned. Look at Simple Google Drive, it's actively supported, more simple, small and flexible.
     
  38. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    482
    It's not abandoned. I'm still using it in my own projects and it works fine. I'm not providing any support for it though, hence it's not published on Asset Store (which requires publishers to provide support, even if the asset is free), but on GitHub.
     
    chelnok and hopeful like this.
  39. DoublespeakGames

    DoublespeakGames

    Joined:
    Oct 6, 2014
    Posts:
    4
    I'm trying to use this in an Oculus app, and having trouble with the OAuth. Pretty sure I've followed all the instructions to the letter, but I get "Access Blocked: Authorization Error" from Google Auth.

    Code (csharp):
    1.  
    2. Error 400: invalid_request
    3. Request details: redirect_uri=com.mycompany.myapp:/oauth2callback
    4.  
    Anyone have any ideas?