elringus / unity-google-drive Goto Github PK
View Code? Open in Web Editor NEWGoogle Drive SDK for Unity game engine
Home Page: https://forum.unity.com/threads/515360
License: MIT License
Google Drive SDK for Unity game engine
Home Page: https://forum.unity.com/threads/515360
License: MIT License
Hello again, I'm not trying to be annoying, but i've spent some time trying to figure out how appdata folder works. In unity it shows me bunch of errors when i try to list of upload a file to drive. I've read that you need to request appdata scope in order to access it. I'm just wondering, perhaps you could help me figure this out, because I'm really not good with Goole Drive stuff yet :) Thanks in advance.
Hello. I have downloaded the latest version of this plugin and did all the steps to make it work on android. The problem is, as soon as i try to login with Google Drive, my app jus crashes. I don't know what to do. Thanks in advance!
On Android I am not getting an auth screen.
It works fine on iOS. Below is error log.
No idea when this issue crept in. I found that play service resolver was not correctly downloading dependencies, but I fixed that.
12-24 09:13:19.233 24816 24836 E Unity : at UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jclass, System.String methodName, System.String signature, System.Boolean isStatic) [0x0 12-24 09:13:19.522 24816 24836 E Unity : AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='SetResponseListener' signature='(Lcom.elringus.unitygoogledriveandroid.AuthorizationActivity$OnAuthorizationResponseListener;)V' in class Lcom.elringus.unitygoogledriveandroid.AuthorizationActivity; 12-24 09:13:19.522 24816 24836 E Unity : java.lang.NoSuchMethodError: no static method with name='SetResponseListener' signature='(Lcom.elringus.unitygoogledriveandroid.AuthorizationActivity$OnAuthorizationResponseListener;)V' in class Lcom.elringus.unitygoogledriveandroid.AuthorizationActivity; 12-24 09:13:19.522 24816 24836 E Unity : at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:49) 12-24 09:13:19.522 24816 24836 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 12-24 09:13:19.522 24816 24836 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0) 12-24 09:13:19.522 24816 24836 E Unity : at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151) 12-24 09:13:19.522 24816 24836 E Unity : at android.os.Handler.dispatchMessage(Handler.java:104) 12-24 09:13:19.522 24816 24836 E Unity : at android.os.Looper.loop(Looper.java:166) 12-24 09:13:19.522 24816 24836 E Unity : at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20) 12-24 09:13:19.522 24816 24836 E Unity : at UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jcla 12-24 09:13:20.528 24816 24874 E Unity : java.io.EOFException 12-24 09:13:20.528 24816 24874 E Unity : 12-24 09:13:20.528 24816 24874 E Unity : (Filename: Line: 390) 12-24 09:13:20.528 24816 24874 E Unity : 12-24 09:13:20.773 24816 24868 E Unity : java.io.EOFException 12-24 09:13:20.773 24816 24868 E Unity : 12-24 09:13:20.773 24816 24868 E Unity : (Filename: Line: 390) 12-24 09:13:20.773 24816 24868 E Unity : 12-24 09:13:59.802 24816 24836 I Unity : Rebuilt 12-24 09:13:59.802 24816 24836 I Unity :
I'm downloading my large files in 512k chunks. I'm using DownloadRequest.Progress to monitor progress of the chunk download every second. The issue is that Progress remains a zero for the entire chunk download (sometimes up to 10 or more seconds worth), only occasionally do I get a non zero value as the last very last Progress reading before the chunk download is actauly completed.
I'm using WebRequest.uploadProgress for monitoring upload progress for each chunk and it's working perfectly.
Is Progress implemented correctly? Is there a reason it's not reporting progress over the course of the download?
Hi! My scenario:
Expected result:
Actual result:
Also I expect request.IsError = true if authorization process is cancelled anywhere later (wrong account, wrong password, no internet connection, permission denied, i.e. when we return to the app without success).
There should be a way to allow users to stream the file's data (both up and down) to the drive independently of the metadata API calls, so it'll be possible to use any type of caching or sequential reading to preserve memory usage.
Hello again. It's been a while. I've been using your plugin for a long time and i've got to say - it works almost perfectly. The time and effort you put into this is amazing. I've got a few questions about this plugin, which I couldn't answer myself and I hope you can help me :)
Is there a way to know if a user has cancelled or timedout the request? Because every time i cancel an auth request i get an error and the whole app just freezes.
Does this plugin support token saving (So that i wont have to log back every time)? My app starts the whole auth procedure quite frequently. (like 15 minutes after logging in I restart my app and have to log in again)
Anyways, without this plugin, I probably would have been at a loss, so thanks you. Take care!
Hi Elringus
I'm currently trying to create an AR unity project that will run on the Hololens with Google Drive integration.
After I downloaded a zip of your repo, I tried building the project as:
PC, Mac, & Linux Standalone
This option works and i was able to generate an .exe file
However, when I changed the platform to UWP specialising in hololens, I received errors such as the one below:
Was just wondering if the UnityGoogleDrive is compatible with AR focused projects?
Current setup requires the app id to be lowercase. Details can be found here: https://github.com/Elringus/UnityGoogleDrive#my-application-id-andriodios-is-mixed-cased-and-i-cant-change-it
In case anyone would like to work on this issue, feel free to ask here for any additional information.
As of 07/11 something must have changed in the google drive api or backend since any upload (either creation or update) is returning a malformed multipart body error.
This didn't occur yesterday, or even this morning
Hello,
First I want to say again thank you for this plugin.
As said in the title I have a issues with the redirection. After the authentification it don't go back to the app.
I followed the tutorial instruction and I have create 2 OAuth client ID (a web app and iOS).
But when I authenticate it seems use the web app OAuth (because the name that appears is the name of the web app). Is this normal ?
What should I do for after an authentication go back to the app?
Here is a screen of the google drive settings if it can help.
Thanks.
Currently, a blocking http listener is used to handle oauth requests while performing the authentication in browser. This leads to application being "frozen" until it receives the response from the oauth server. We could try improve this by using an async http listener.
Hello
I'm almost ready to publish my first game on Play Store but I'm having a lot of problems with Play Services.
I didn't figured it out how to use "Save Games" with GPS,all I need is to save an int number or two,so I'm here and I still can't figure it out.
I use a custom Player Prefs asset for saving but unfortunately it gets deleted after uninstalling the game.So i tried saving the numbers in a binay file,it worked but it's not as good and simple as PlayerPrefs.
It's been couple of days and I just can't figure it out.I simply don't understand the codes that are about files.
Today,I got and idea how could that be done.So if I could let's say in a script on Awake to declare a variable,create a file with the int number in it,upload it on Drive.
Example:
int Score;
void Awake()
{ /LOAD/
->Download from Drive; ///If the player is an old player
->Use the int number accordingly;
/SAVE/
Score=PlayerPrefs.GetInt.... ;
->creating a file with Score;
->upload it on Drive;
->delete the file on the drive or change it to null;
}
I use PlayerPrefs in the script because every code that saves or loads is using PlayerPrefs so it is easier to simply use it and not rewrite the scripts.
I would be grateful to get some help.Thanks.
hi there, i m facing issue with uploading a png file to drive. I have followed instructions from the link (https://github.com/Elringus/UnityGoogleDrive). when i click upload nothing working. i have targeted this app for android. below is my script attached please suggest for solution.
this is my id - [email protected]
Hi,
First of all, thanks for the really nice plugin.
Application.OpenURL
call, and the LoopbackResponseHtml
response, so if a user is using any other web browser plugin within his game/application can take the benefit of that browser and give the feel of a native work to their users.UniWebView
plugin so I should have to get the benefit of it and even I can close the browser when it is authenticated.What do you say?
In OnDone
after Download
file, there are a lot of properties which remain null, just a few are set. Not even FileExtension
and FullFileExtension
In List
call, files are returned from the team drive, not my personal drive
Can you make a call, which returned PDF files from my Drive and on a selection of any PDF file downloads it
You are not returning any error in case of error, to know whether the call is successful or not. The only way is to see the exception in the console
I'm not a native English speaker and could've done some mistakes in the readme, code summary and UI text (especially in the settings editor). Any corrections either via comments here or direct pull requests are greatly appreciated ;)
Hello. I've been using this plugin for a while now, and I have to say it works like a charm. I just wanted to ask is there a way to redirect the user back to the application after login? Thanks in advance :)
Currently, a third-party library (Json.Net.Unity3D) is used to de-/serialize JSON data, since Unity’s built-in one doesn’t support nullable types (and they’re heavily used in the data API to represent properties not included to a request/response). While the library itself works fine, it doesn't support .NET 2.0 subset profile and the performance is not that good compared to the Unity's JsonUtility. Maybe someone has an idea how to make nullable types work with the Unity’s JSON tool without complicating code base too much?
Hi, in this SDK have a function for logout after Auth? I was tested but I can't found it, can you help!?
Hello, i just have one question: is it possible to upload to and/or download from appdata folder in google drive? Thanks in advance :)
Hello. I've updated Unity to the 2019 alpha and I'm getting some errors from this plugin. (.net 4x)
Assets\UnityGoogleDrive-master\Assets\UnityGoogleDrive\Editor\GoogleDriveSettingsEditor.cs(51,78): error CS1503: Argument 2: cannot convert from 'string' to 'System.Func<UnityEditor.Editor>
Assets\UnityGoogleDrive-master\Assets\UnityGoogleDrive\Editor\GoogleDriveSettingsEditor.cs(52,77): error CS1061: 'AssetSettingsProvider' does not contain a definition for 'CreateEditor' and no accessible extension method 'CreateEditor' accepting a first argument of type 'AssetSettingsProvider' could be found (are you missing a using directive or an assembly reference?)
Assets\UnityGoogleDrive-master\Assets\ThirdParty\UnityCommon\Editor\PackageExporter.cs(66,32): error CS7036: There is no argument given that corresponds to the required formal parameter 'scopes' of 'SettingsProvider.SettingsProvider(string, SettingsScope, IEnumerable)'
Hope you can help :)
Alright, despite that error, I have a few more questions for you:
What if the user closes the auth window witchout clicking "accept" or "deny". In this case request is not done, but it is not an error either?
Can I change the loopback repsonse html text? My app features multiple language suppor and I want to make the response text according to the current user language.
Thank you in advance, and continue being awesome :)
Might be a silly question, but I can't figure out if this supports resumable uploads? If it does, could someone post an example?
Thanks
Joe
Hello @elringus, Firstly thanks for the awesome project, easily integrated into my project.
I would like the user to click a button to authorise, but to hide this button if already authorised. Is it possible to check if authorised without sending the auth request?
Creating a file with "GoogleDriveFiles.CreateRequest" creates a file with 2 additional bytes compared to "GoogleDriveFiles.ResumableCreateRequest"
I suspect the issue is with CreateRequest as updating the file with both UpdateRequest and ResumableUpdateRequest yield the same hash after upload as the ResumableCreateRequest.
As a side note, I would be happy to use the ResumableCreateRequest, but the response data when creation is finished is only a string and I need to get the webContentLink (which can be fetched with CreateRequest), the ResponseData field is a string only which contains information on how to resume the upload
I am having null ref exception for the following line
var applicationActivity = applicationClass.GetStatic<AndroidJavaObject>("currentActivity");
am I missing anything?
Hi!
Set the settings file as mentioned, edited the bundleId then run a direct build to iOS.
First build gave this :
Then edited WindowRect variable from the first scene (which do not even match on mac book display...)
Made another Build & Replace then getting new error :
... which now always show up even with a Build & Replace to get a fresh project from scratch...
Any idea? ...
That would be super kind!! ^_^
Thank you so much :)
I apologize if this already exists but I am unable to find it. I am using UnityGoogleDrive to sync the files from an entire folder in google drive to the documents folder of a pixel art app and vice versa, and it mostly works perfectly.
The only flaw is I need to be able to see when the user deletes a file from google drive so I can delete it from the local documents folder.
Looking at the API, I believe I need to use the changes call with the date of the previous call to get this information correctly, but I don't see anything related to this in UnityGoogleDrive. Is there any chance you could add it?
This was working fine, but coming back to retest now (after all the new features), the iOS authentication is failing now.
Failed to execute authorization procedure. Check application settings and credentials.
We tried changing to 4.6 scripting - but that breaks the entire app on iOS and downloads stop working on Android :(
Please advise how best to debug and fix this?
Joe
I have followed all the documentation and it works perfectly on the unity editor. But on an android device, it asks for access, and if i press allow it redirects me to google.com rather than the loopback uri. I made sure my package name is all in lowercase. Some help would be very appreciated.
Hi, this is great, so can I using this API for storage file in my game, can log in my account to any device thought my info in code, don't need to log in via a browser. Thanks so much for the git!
Hi!
I am currently configuring your package to eventually upload data from a VR application to google drive. Are there example scenes / scripts I can run (or a tutorial to follow) to test to see if I have installed correctly?
Thanks,
Harrison
Hi,
when trying to run the test code
var file = new Data.File() { Name = "Image.png", Content = rawImageData, MimeType = "image/png" };
GoogleDriveFiles.Create(file).Send();
, unity complains "The type or namespace name `Data' could not be found. Are you missing an assembly reference?"
My script adds the namespaces
using System.Data;
using Mono.Data.Sqlite;
using Mono.Data.SqliteClient;
Can you maybe point me to a solution?
I'm making Pixel Studio, mobile pixel art editor. Hope I will be able to make cross platform gallery sync with your plugin soon!
BTW, you could add await examples as seems it works just fine with Unity 2019
var file = await GoogleDriveFiles.Download(id).Send();
It's much better than coroutines as you can return values when operation completes.
Also I had some difficulties with calculating check sum, I think you can add this feature to the plugin.
public static string ComputeHash(byte[] inputBytes)
{
var hash = MD5.Create().ComputeHash(inputBytes);
var stringBuilder = new StringBuilder();for (var i = 0; i < hash.Length; i++)
{
stringBuilder.Append(hash[i].ToString("X2"));
}return stringBuilder.ToString().ToLower();
}
hi! i already figure it out how to upload .db files, my only problem is how can i download it and save it to a specific folder?
Hello Elringus.
I am getting this error when running on iOS.
UnityGoogleDrive: Failed to execute authorization procedure. Check application settings and credentials. UnityGoogleDrive.AuthController:HandleAccessTokenProviderDone(IAccessTokenProvider) UnityEngine.AsyncOperation:InvokeCompletionEvent()
Settings are correct as it is working on Android.
Any ideas?
Same as for the multipart issue we had a few days ago now they went on to screw things with resumable uploads. just wanted to let you know
I started working with his SDK and it worked perfectly for the editor and Android, however when I tried using it in iOS everything died.
It calls the login screen, an when you are supposedly logged, it redircets you to Google instead to the redirect uri, i. e the one that says "return to the app"
Also 2 errors are displayed in the console:
#1
UnityGoogleDrive: OAuth authorization error: Error: The Operation coudldn't be completed (org.openid.appauth.general error-4.)
UnityEngine.DebugLogError(Object)
UnityGoogleDrive.IOSAccessTokenProvider.HandleResponse(string)
#2
UnityGoogleDrive: Failed to execute authorization procedure. Check application settings and credentials.
UnityEngine.DebugLogError(Object)
UnityGoogleDrive.AuthController.HandleAccessTokenProviderDone(IAccessTokenProvider)
Hello. I've tried out this plugin and it works amazing! But I have just one problem: there is only an option to download a file using fileId, but can i find a file by its name and download it that way? Thanks in advance :)
Hello. I have a rather weird question. Every time I log in using this plugin I get a security notice in my gmail telling me someone logged into my account when other apps that use authentication with Google don't get this behavior. Is it possible to remove these notices? Thanks in advance.
hi there, i want to upload file to shared folder please tell me how can i do that. i got confused with example scene "GetFileByPath"
Hi, I'm creating an app for Oculus GO (Android) and I'm using the plugin to download some images and use them as slides for a presentation. When I do the listRequest it opens the online browser and opens the Google login page, when logged it says the app needs offline access.
When I click Allow it gets back to Google and I have to reopen manually the app, but the list is not visible. As it is a special type of Android it may need a different type of callback to get the information correctly... Any ideas?
Implementing permissions would be of great help
I tried doing it myself once again, but it takes a long time to understand how this works due to the many abstraction layers.
I'm using Helpers.FindFilesByPathAsync to return a list of files from a specific folder on my Google Drive. At first it seemed to be working just fine, returning every file in the folder. Then I created a new file within the folder, and it does not recognize this new file. I've waited >24 hours assuming Google Drive APIs have some kind of delay, and yet the file is still not being picked up.
When I delete or move an older file from within the folder it is no longer picked up, and if I turn on the trash flag it will pick up old deleted files, but it will not pick up any new files. I also tried making exact copies of old files, and still no luck.
Is there a local cache that UnityGoogleDrive makes that I'm unaware of?
hi there, i m built the app successfully for the android, while building for IOS i m stuck with the error "AppAuth.h" file not found. can you please help me out to resolve this issue.
I am using this asset package to upload the data on my google drive. It is working in the editor, I am able to upload all the files when playing the game in Editor. But it doesn't work with the PC standalone build. When I played the exe file, the screen got stuck and and in browser a page was opened (behind the scenes) to ask for permissions. Usually I would expect the browser window to be popped up so that I be able to grant permissions, but no such thing happened. Instead my game screen froze and ultimately I had to force quit. This happens everytime I run the game, even if I have already given the permission by visiting this URL
Hello again. Right now I have just one bug left to erase, before this plugin starts working perfectly (for me at least), so because of that, I'm here to ask for help. You see, when I click login and don't click Accept nor Deny, everything seems okay, but if I try to click Login one more time, it just doesn't do anything. I can click the Login button in my application as much as I want, but literally nothing happens. I wonder if you know what could cause this type of behavior? Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.