Unity - Get data from Google Drive ( JSON data, Images, ... )
ฝัง
- เผยแพร่เมื่อ 9 ก.พ. 2025
- #madewithunity #unity3d #unity #indiegame #gamedevelopment #gamedev
How to get JSON data and images from Google Drive in Unity
■ASSETS :
github.com/her...
□LINKS GENERATOR :
herbou.github....
🌐Follow Me :
Facebook : / h.herbou
Instagram : / hamza_herbou
Behance : www.behance.ne...
❤Support Us :
☞Paypal :paypal.me/hamz...
☞Patreon : / herbou
Simple way to connect external data to Unity. I have been following and have implemented your other playerprefs tips as well to load and save data in my project. Very useful tips.
Chdid tbarkellah 3lik khouya hamza , Amazing ♥
I NEVER THOUGHT THAT I CAN EVEN DO THIS! SERVER AND UNITY THAT EASY SO COOL
Ok, you told me you are not God, but you help me again bro, really thanks for your work.
you're welcome bro . I'm trying to do the best and share everything to help others and that makes me happy.
especially comments like yours ❤ it motivates me a lot
thank you
Wow sir you are AMAZING. THANK YOU. This just changed everything.
❤❤❤❤
Thank a lot for your vids. :) Hope to see some more.
nice one!! you always comes up with something new!
Que beleza!!! Parabéns! Obrigado! From Brazil!
Amazing video, thank you so much!
Hello, I can not update data we can get add delete but not update how can we do that? And is there any solutition for all players can reach same data using google drive or any other third party? Thanks.
Thanks, I didn't know about the direct download link thing
Great brother,
Nice tutorial 👍
Thank you! Cheers!
Any ideas for how to get it working on webgl? Getting CORS errors when trying to GET files
Hi Hamza.
I implemented the video and everything has been working fine for 6 months. But it suddenly stopped working a week ago. Do you know if there have been any changes to the json system with Unity recently?
In the Unity editor I now receive the following error message when trying to download the file:
ArgumentException: JSON parse error: Invalid value.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at :0)
UnityEngine.JsonUtility.FromJson[T] (System.String json) (at :0)
Everything had been working fine for 6 months without any errors until last week. :(
Thank you very much for your tutorial videos!
thanks for very useful tutorial. may i ask something pardon me, i have written as you did, but why only text which updated, my raw image still nothing happen. thanks for your help before.
This works from export data instead of geting from drive?
Great work man!
What if we want to download the file in the local storage of the system not in the unity
Thank you! One question, is it possible to store the image in user device?
Will the downloaded data be lost when the app is closed or will it still be there?
hi bro, i follow your steps but, the iserror function return "unknow error", i hope your help, thanks in advance
Is it only read only or can we change/write from unity to json?
thank you so much for sharing. you one of a kind ♥️
Thanks for that clear tutorial! Is there any chance that you could make another tutorial to upload or update that JSON from within Unity?
I really appreciate your work, thanks for sharing!
in this case it's better to use another solution : Firebase storage
@@herbou I used Firebase in another project but it's far more heavy and complex that the JSON staff. Thanks for answering ;)
@@herbou Can u do this but instead of Json use python
THIS GUY DESERVES 10M SUBS
WELL YOU CAN CHANGE YOUR CHANNEL NAME FROM HAMZA HERBOU TO UNITY TUTS OR ANY COOL NAME SO THAST PEOPLE CAN RECOGNZE YOU AND YOUR GROWTH WILL BE AWESOME AS YOUR VIDEOS ARE VERY MUCH HELPFUL AND A LOT MORE AMAZING.YOU CAN ALSO TRY TO ADD YOUR VOICE IF IT IS POSSIBLE EASILY
WELL AWESOME VIDEO BRO :)
thank you my friend ❤
can i do it with docs too??
Thank you so much for this!
You always amazes me.
what version unity you are using?
Does anyone know if the file can be edited or can only be read?
Could this handle 3d models?
thanx bro it's too helpful😇
Will the image link yo json method will work for Android studio?
yes
@@herbou it already worked, thank you so much master !!
cool coloring, what is this IDE?
Excuse me, i have a question, i want to update my file a my repository in google drive ....i use android in my project...how i do it?
i don't know what you mean by updating file
Thanks a lot, you are amazing 👏
Great tutorial,
Your videos are alway something new to learn from
Is it possible to use post instead of get to update strings floats or int on the json file with may be like creating a separate client app for updating the json file datas...?
I don't have any idea . but I think it's better to use firebase for that
@@herbou I am hoping you do a tutorial like this one using firebase in the future 👍
Is this works after the app is build to ?
it should work
From where you find music for your videos
youtube audio library
Great work !!
Thanks for the content..it was really helpful....but I needed a help as I'm stuck at an error...error is: when I play the scene .it starts f9.. connects to json file...but at line wherein we store data in structure.. it gives an error saying "Missing a name for object member".. Can you please help me out with it🙏
show me your json and your struct
@@herbou thank you for the help and responding so fast. But I found my error and have fixed it (error were the json file format). Thank you. Your contents help a lot, so please keep making more😇🙏.
Hello! Thank you for your tutorial - I have two questions. On is regarding the following error. CS0618 "UnityWebRequest.is network error is deprecated. Use (UnityWebRequest.result == UnityWebRequest.Result.ConnectionError) instead." unfortunately even if I use the .result example it will lead to an compiler error.
And opening Unity Console : ArgumentException: JSON parse error: The document root must not follow by other values.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at :0)
Secondly, I would like to ask to which extent it would be possible to create a request with a path to my drive desktop application?
check the github link in the description
how would you work with multiple data? and not just one JSON data. Also is it possible to post and update JSON file from unity?
you can work with multiple data in one json file.
I'm sure there is a way to update data from unity . using APIs to access google drive files
@@herbou can you make tutorial for that?
i can't now. it may take a lot of time in researches
about google driver. It can access in all country in the world?
yes
@@herbou cool man, I think you should make a video like that about addressable to store game asset (prefabs) too :D
thank you for your suggestion 😊
Thank you for the guide, it seems quite easy to do it but how can I do this with a text file/ csv instead?
yes it's the same thing except when you load csv in unity you need to parse the data (read the data line by line)
Hi work in editor fine but not on android device do you know how to solve this?
It should work on mobile too.
@@herbou yes it is working now thanks
@@muhammadhassan581 hello please help
@@Guardabarranc yes dear
@@Guardabarranc how can i help you?
Hey! Amazing job you're doing here! Just a question, how would it be if I wanted to retrieve a whole folder from google drive and store it somewhere on my device? (using unity)
Did you ever figure this out please?
I use my own picture on my Google drive and use the generate tool to get the image link. But the image still load failed? Could you help me to check that? Many thanks! I changed your image link, it works well! Is there any other permission change in google drive?
you can use github to store images and get direct links from there
@@herbou Thank you so much!
hello, i would like to learn how to use images generated by google maps, google earth, to create scenarios for games, and also how to make missions system as in joho il-2 for example, thanks
It's working for mobile ?
please give me "unity install setup file" google drive link. I'm new.
wallah bravo bro, sou2el : if i have for example 3 pictures which i want to get them in same time i mean through a next button and back it takes you to next image,,, how can i change the Script and the Json file ?
hadchi khasso tutorial 😂
@@herbou hhhhhhhh you are so pro bro , you can do it besa7 huwa nafs El concept juste array to add it to Script for 3 pictures for example ..hiya me3raftesh ndirha
@@nabilhamouda1472 nfs blan chno drti fih f lkhar l9iti l7ala ??
whether the image can be replaced with a video
yes it's possible, check the comments
@@herbou Sorry, I'm still a beginner...
can you make a video like this but more than 1 picture
Load data from server (text/images) in Json format: th-cam.com/play/PLMWgYNtBT-xOnWLfohr_1CwEIB5IT_62H.html
i use unity 5.6.6f2
Bro your video was very helpful but one problem after so many time fetching data from google drive i get 401 error. because of this players cannot download images at least for 5 min, but after 5 minutes it is ok but many players complaint about it they face this problem constantly. is there any solution for this error?
you can use this plugin in this video
th-cam.com/video/loUfR04HqHs/w-d-xo.html
to cache images so that you don't have to download it each time . only one time at the game start .. then the next request will be in the next game run
Bro thanks a lot for replying and sparing some of your precious time for me. But saving like that won't work. Because I will be updating the images and string weekly and If I set the save method, I have to set the expiration date for that image. But such things are hard for me. But i shall do as you said. I am also looking to see if there is any other way. Reply only if you get time. I am satisfied with your first reply itself. You are so good thank you.
you can save the images only when the game is running .. when the user quits the game and restart again the game downloads the images again .. this method will make sure that always one request is executed the google drive
Thanks bro that's a good solution. So can you tell me the part about that plugin that saves the image in the cache? I have very little knowledge in unity and coding so I didn't understand where in your video you talk about that plugin so can you mention the time?❤️
Is that struct data saving everything?
Puedes hacer un tutorial de mostrar datos de una tabla de google sheets porfavor
Donde pueda leer datos en texto en la pantalla de unity
A lah i7fdak akhoya had l video nfa3ni bzzaf khossossan tandir l call admob IDs mn json . thank you so much.
o3andi wa7d so2al ila momkin tjawb wash kayna shi tari9a tsawb wallpaper fl unity ?
ila kan ghir tjbd wallpapers mn server o tbynhom f game had tari9a nit rah khdama ..
@@herbou oui bghit njbad wallpapers mn server lgame o7ta download l phone . wash had tari9a momkina fl unity.
ma9lbtch mais ghatkon
@@herbou Ok khoya lah i7fdak
bro it's not working I am getting an error
1. Some scripts have compilation errors which may prevent obsolete API usages to get updated. Obsolete API updating will continue automatically after these errors get fixed.
2. All Compilers errors have to be Fixed (when i click on play button)
download the project from github
@@herbou the problem is the unity version
Thank you bro 👏👍
Muito obrigado irmão.. resolveu meu problema...aahahahahaaj
FUNCIONA pra baixar um video tambem ?
Will this be restricted from accessing by google ??
why??
Amazing tutorial but i have a one question if i have this type of data then how to retrieve
{
"Scores" :[
{
"Away_score" : 1
},
{
"Away_score" : 2
}
]
}
check this:
th-cam.com/video/-Z4s7aIn-Og/w-d-xo.html
قناتك من افضل القنوات التعليمية واصل .
هل هنالك طريقة لتحميل فيديو عبر جوجل درايف .عندي تطبيق لكن مساحة التطبيق كبيرة واريد حفظ فيديوات في جوجل و اللاعب يقوم بتحميل الفيديوات لمرة واحدة فقط .هل يوجد حل
لم اجرب من قبل لكن متأكد ان هناك طريقة في مكان ما
@@herbou شكرااااا اخي على الرد .لقد وجدت طريقة لتحميل من جوجل درايف ومن فاير باس .شكرا مرة اخرى على الرد و شكرا على فيديواتك تعليمية الرائعة 👏👏👏👏
@@zakitrad-l4z سلام صديقي .. لدي أيضا نفس المشكل ..مع فيديو لا يشتغل و لكن مع الصورة يعمل جيدا ....كيف وجدت الحل من فضلك ؟
@@nabilhamouda1472 public string link;
public Slider progressBar;
public Text m_downloadProgress;
void Start()
{
}
public IEnumerator ShowDownloadProgress(UnityWebRequest www)
{
while (!www.isDone)
{
Debug.Log(string.Format("Downloaded {0:P1}", www.downloadProgress));
m_downloadProgress.text = (string.Format("{0:P1}", www.downloadProgress));
progressBar.value=www.downloadProgress;
yield return new WaitForSeconds(.01f);
}
m_downloadProgress.text="100";
}
IEnumerator DownloadVideo()
{
UnityWebRequest www = UnityWebRequest.Get(link);
// mirrors.standaloneinstaller.com/video-sample/lion-sample.mov
StartCoroutine(ShowDownloadProgress(www));
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
string _pathToFile = Path.Combine( Application.persistentDataPath,numbr+ ".mp4");
Debug.Log("m" + _pathToFile);
File.WriteAllBytes(_pathToFile, www.downloadHandler.data);
}
public void Stardown()
{
StartCoroutine(DownloadVideo());
}
}
Great bro, you are amazing. Is it possible to download a 3d model in unity with .json?
Does this work with videos?
I've never used videos with unity.. but i'm sure it will work
How do I make the URL be data.json?
watch the full video
@@herbou I have seen it complete but I want it for this that you show in this video th-cam.com/video/z-H37N6Mjlk/w-d-xo.html and how you teach how to do it here does not work for me because the URL I need cannot carry .com and it must end in data.json for it to work, otherwise it gives me this error in console. ArgumentException: JSON parse error: Invalid value.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at : 0)
UnityEngine.JsonUtility.FromJson [T] (System.String json) (at : 0)
UpgradeSystem.NewUpdatesPopupUI + d__8.MoveNext () (at Assets / Game / scenes / NewUpdatesPopupUI.cs: 58)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at : 0)
i will face with 403 error because the app doesnt have any permission to access google drive content
What about multiple photo how to do that
just watch this playlist and you will get the idea 😊
Load data from server (text/images) in Json format: th-cam.com/play/PLMWgYNtBT-xOnWLfohr_1CwEIB5IT_62H.html
you are genius;)
we need the same thing wth saving data from unity to google drive text editor
nice.
NIIIIII9ICECEIEIECIEICEICIEIC AMAZNG GG U R THE BOSS
works in videos too?
yes maybe
Next saving and loading google sheet data
Thank youuuuuuuuuu
Can u do thing but instead of Json use python
we can't compare these 2 things,
JSON is a data interchange format , and Python is a programming language.
what do you mean by using python???
the right thing is to compare between JSON & XML
or
C# & Python
@@herbou xml is better then
Make a tutorial in which you make animation for pennies in 3 d space, in canvas image, please.
❤️❤️❤️
doest work
Do a tutorial on google drive new API.
if you mean the c# script. just check the github link .
i changed it to the new API
UnityWebRequest.GetTexture (url) ; to UnityWebRequestTexture.GetTexture(url);
Your video is dynamic too good but plz when u make video say something not music
Is it possible to upload data to google drive, like saving player data
sorry . i don't have any ideas about that