Reading a JSON file - an easy how to with Unity3d

  Рет қаралды 71,351

Destined To Learn

Destined To Learn

Күн бұрын

Reading a JSON file - an easy how to with Unity3d
Follow me on twitter / jamesdestined
Follow me on instagram / artbydestined
Buy my pieces on redbubble DestinedArt.red...
Any comments or questions welcome. Enjoy the video!
Song: TheFatRat - Ascendancy, allowed to be used as per
• TheFatRat - Warrior So...

Пікірлер: 189
@dancrat3979
@dancrat3979 3 жыл бұрын
This is Amazing! Exactly what I was looking for in my project. Thank you so much!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
You're very welcome! :) thanks for watching.
@chrislupton7521
@chrislupton7521 2 жыл бұрын
Short, sharp and concise. Please don't think I'm blowing smoke when I say this is the clearest KZbin tutorial I've ever come across. 10/10
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
thank you for the kind comments :) it gives me confidence to make more videos.
@trinivet
@trinivet Жыл бұрын
Thank you for a straightforward and simple explanation on how to use JSON. Now that I can grasp it, I can move on to more complexed JSON usages
@DestinedToLearn
@DestinedToLearn Жыл бұрын
glad it helped :)
@RossYlitalo
@RossYlitalo 2 жыл бұрын
Short and to the point: exactly the way it should be! Thank You!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
thank you for feedback
@amogh2101
@amogh2101 3 ай бұрын
Thank you for this. It worked as described. I ended moving the two classes into their own scripts and it worked the same.
@DestinedToLearn
@DestinedToLearn 3 ай бұрын
:) glad it worked. I just kept them separate cause I like keeping scripts small
@42fba
@42fba 2 жыл бұрын
This tutorial is amazing! I had been looking for hours for information on how to read or parse and deserialize a Json array in my C# script in unity and this awesome video is the first place I saw to mention that two different variables need to have the same name for it to work. Thank you so very much!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad it helped :)
@monoculosofficial9934
@monoculosofficial9934 Жыл бұрын
Amazing! Quick and easy to follow and shows a more complex use than some tutorials!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
glad you found it useful
@jesuschrist69
@jesuschrist69 Жыл бұрын
Thanks a lot. Really good tutorial. Took a minute to adapt to my project but was able to get it, and it's great!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
glad it helped :)
@hauntedcrowdev
@hauntedcrowdev 6 ай бұрын
Thank you! I was having trouble getting this to work. Your video helped me a lot!
@DestinedToLearn
@DestinedToLearn 6 ай бұрын
glad it helped :D
@gabormolnar1336
@gabormolnar1336 2 жыл бұрын
Many thanks very much! There is no clearer and more understandable tutorial I have seen so far. :)
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad you liked it :)
@rauljerilara
@rauljerilara 3 жыл бұрын
Thank you! Your explanation was very concise and very helpful.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Glad you found it useful :)
@quattrocity9620
@quattrocity9620 2 жыл бұрын
This was great thanks! I'm trying to figure out how to load in models/equipment based on attributes in a json file stored online. Obviously there is no tutorial for this but this has been the most helpful so far!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
You just need to use unity webrequest to download the page and then use the tutorial as is docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Get.html
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
also if your json doesn't follow this format you will need to use the newton json for unity.
@quattrocity9620
@quattrocity9620 2 жыл бұрын
@@DestinedToLearn Thanks for the reply. The format is different I'll have to check into this newton json. You can probably tell I'm brand new. I appreciate your time.
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
@@quattrocity9620 The process is pretty similar, the built in one isn't very forgiving with format. Good luck I hope you get there with your project. I will do a sample webrequest one this afternoon as I get asked that a bit.
@quattrocity9620
@quattrocity9620 2 жыл бұрын
@@DestinedToLearn awesome! Subbed with notification. Look forward to it.
@diesti5508
@diesti5508 6 ай бұрын
Thank you! I was looking for this solution!
@DestinedToLearn
@DestinedToLearn 6 ай бұрын
glad it helped
@haystack7077
@haystack7077 2 жыл бұрын
clear and easy, straight to the point. Thanks a lot !
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad you liked it :)
@BrianLindahl
@BrianLindahl 2 жыл бұрын
Great video! Really well described and executed.
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
thanks for nice comment :)
@Yes.Im.Mr.Anderson
@Yes.Im.Mr.Anderson Жыл бұрын
Amazing short answer! Thnx! Thumb up!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
glad it helped
@user-em9su3dd9y
@user-em9su3dd9y Жыл бұрын
Very clear, cheers.
@DestinedToLearn
@DestinedToLearn Жыл бұрын
thanks for the nice comment :)
@syeddaniyalhaidernaqvi6684
@syeddaniyalhaidernaqvi6684 3 жыл бұрын
If anyone is having problems with player list being populated with null values make sure your data class (in this case Player) is not inheriting from MonoBehaviour. I had the same problem and removing MonoBehaviour fixed it 🤗
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Glad you were able to fix that. Would have been a little tricky to find!
@kemmuhammad3958
@kemmuhammad3958 2 жыл бұрын
Made it really simple, Thanks!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad you thought so :)
@explosivekeeper
@explosivekeeper Жыл бұрын
You know how to teach. 🙏 Can you do a tutorial on rewriting the values of specific keys ingame?
@DestinedToLearn
@DestinedToLearn Жыл бұрын
I have a writing to JSON tutorial which shows how to go the other way
@CarlosHub
@CarlosHub 2 жыл бұрын
Thank you
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad it helped
@ovna
@ovna 2 жыл бұрын
ty, it was very well explained ans useful ! i wish u the best !
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad you found it helpful :)
@OuachitaOFFROAD
@OuachitaOFFROAD 3 жыл бұрын
Exactly what I was looking for, Thanks!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
glad it helped!
@PlaymoVillage
@PlaymoVillage 3 жыл бұрын
Hello, I tried your way to load my "hero list" but even if it finds the good "hero" count from the file, the hero class objects in the list (equivalent to your "player" class objects in your myplayerlist) are null... Can't figure out why ! Any thought ?
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
I would assume it is most likely naming and/or formatting of the json file. Remember it is case sensitive and that naming is important. This is the text from the sample json in the tutorial {"player":[{"name":"Warrior","health":"100","mana":20},{"name":"Wizard","health":"40","mana":80},{"name":"Healer","health":"100","mana":120}]}
@St.IrenaeusOfLyons
@St.IrenaeusOfLyons Жыл бұрын
Excellent tutorial. Thank you.
@DestinedToLearn
@DestinedToLearn Жыл бұрын
thank you for the nice feedback :)
@pranaxr
@pranaxr Жыл бұрын
thanks, it solved my query
@DestinedToLearn
@DestinedToLearn Жыл бұрын
glad it helped
@fishtail_6740
@fishtail_6740 Жыл бұрын
Realliy nice!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
:)
@GabrielGcbs
@GabrielGcbs Жыл бұрын
Nice video!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
thank you :)
@martinschiffer4280
@martinschiffer4280 Жыл бұрын
Hello! Nice video. I have a question, if my json looks something like this: { "name": "Some name", "Something": "xyz", "skills" : { "run" : 3, "jump" : 4, "swim" : 6 } How should i make the class? Should i make "skills" be another class or maybe something like a struct? How do i solve this?
@DestinedToLearn
@DestinedToLearn Жыл бұрын
you might want to look at newtonsoft package in the asset store (free). The builtin on supports a very limited set of formats.
@Moon_579_XD
@Moon_579_XD 2 жыл бұрын
thanks brother its really helped so much 🙂
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
thank you I appreciate the feedback :)
@ricoratso
@ricoratso 7 ай бұрын
I know this is an ancient video, but I'm struggling in figuring out how to attach a sprite to these "player" variables. If I have stored sprites (in the resources folder) that I would like to attach to them, how would I do that?
@DestinedToLearn
@DestinedToLearn 7 ай бұрын
I would import all the sprites into an array and then store an index to to sprite in that array.
@GreenuniverseEuro
@GreenuniverseEuro Жыл бұрын
I hope you are still active when I try Debug.Log(myPlayerList); it prints me out JSONreader+PlayerList.... How can I print out individual json values?
@DestinedToLearn
@DestinedToLearn Жыл бұрын
you would have to put it in a for loop to go thru the array to print all the values. something like myplayerlist.player[0].name to access the name in the first element.
@rattlehead9506
@rattlehead9506 Ай бұрын
goat
@DestinedToLearn
@DestinedToLearn Ай бұрын
lol thanks
@klaromin4760
@klaromin4760 2 жыл бұрын
So i am trying to build a trivia game. My Json file contains 10 questions. I want to reach 1 specific question and its answers but couldn't manage to use them in another class.
@nathan77777
@nathan77777 2 жыл бұрын
Thanks awesome tutorial!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
thanks
@whitebaaai8511
@whitebaaai8511 Жыл бұрын
it is not loading the info under MyPlayerList... there is no error messages tho. I followed exactly what was coded. Any idea of what could potential causes this? Thanks !!!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
It is hard to say without seeing the code, join my discord and share the code and I can have a look and see if I can notice your issue. linktr.ee/DestinedLinks
@iAZME
@iAZME 3 жыл бұрын
Thank you! Straight to the point!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
thanks for commenting. I hope it helped!
@Garfield_Minecraft
@Garfield_Minecraft 7 ай бұрын
video is too fast i rewatched many times and still doesn't understand anything it's too hard i'm having learning disability(ADHD makes it hard to focus things) can anyone explain step by step with simpler json file? i only need load
@DestinedToLearn
@DestinedToLearn 7 ай бұрын
sorry :(
@DmitriyDarkJoney
@DmitriyDarkJoney 3 жыл бұрын
Thank you!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Thank you for letting me know you liked it :)
@Kaasbaas1234
@Kaasbaas1234 3 жыл бұрын
I get unexpected node type. I just want to get the lng latitude out of a json string. The json string looks like this in the console (ofcourse i changed all the values) "ip":"stringwithmyip","location":{"country":"countrycode","region":"provincename","city":"cityname","lat":float,"lng":float,"postalCode":"postalcode","timezone":"+02:00","geonameId":geonameid}
@Kaasbaas1234
@Kaasbaas1234 3 жыл бұрын
I'm trying to only parse the lat and lng values
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@Kaasbaas1234 did you also change the variable names to match? Everything has to be perfect. I do wonder if the : in 02:00 is an issue. I can't tell what is wrong from there. If you post your script and json file to pastebin I am happy to have a lot.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@Kaasbaas1234 If that is the format it won't work with the built in JSON reader. You could try to use the newton one from the store (I have no experience) but you easily just read in the string and make your own parser since you only want some of the data. Just use split like in my Reading text files tutorial.
@Kaasbaas1234
@Kaasbaas1234 3 жыл бұрын
@@DestinedToLearn Thanks for the help i would have been stuck on that for a while... Decided to go a different route and seperate my json into string elements, then used regular expressions to get the longitude and latitude out of the corresponding elements. this is the pastebin link for those interested qumEhgRm
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@Kaasbaas1234 Glad you got it sorted :)
@jackfurmanek4290
@jackfurmanek4290 2 жыл бұрын
I have a problem inside my main array called "cards" lies another array "effects" consisting of strings and ints, I cannot for the life of me figure out how to access that sub array, do you have any idea how to do it? Whenever I use an object array, it fails to read in all the data from that array
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
you need to use newtonsoft json (free from asset store), the built in JSON reader is very restrictive of the format it works with. The newtonsoft one uses pretty much identical functions and barely adds any overhead to your project (less than 100Kb)
@valodyash
@valodyash 2 жыл бұрын
Thanks man!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
you are welcome :)
@gabrielaguiar5984
@gabrielaguiar5984 2 жыл бұрын
I have a key-value json file, how I can get and set a value to a text object and use key as identifier?
@xalalakos
@xalalakos 2 жыл бұрын
Thank you! Very helpful!
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad it helped :)
@xalalakos
@xalalakos 2 жыл бұрын
@@DestinedToLearn I have a question though. Can the Name or the Health have a list of names and so on, in the Unity inspector?
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
@@xalalakos you mean extra layer of detail in the JSON? Not with the built in importer. You would need to use the free newtonsoft asset from the asset store for more complex JSON.
@coacopaco
@coacopaco 2 жыл бұрын
Thank you so much for this
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad it helped
@iftikharmahmud4989
@iftikharmahmud4989 2 жыл бұрын
I have different gameobjects with unique id's. I have formatted my json accordingly as you did with name. How can I get rest of the datablock according to id? ;-;
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
do you want to share your json via pastebin so I can see what you are talking about?
@aashutoshdabhade4325
@aashutoshdabhade4325 3 жыл бұрын
thank you.it was very helpful!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
you are welcome, glad it helped!
@ethnicsovereignty2369
@ethnicsovereignty2369 Жыл бұрын
Great tutorial, really helps build intuition! I however have a question, what would we do if we had let's say a JSON object containing other JSON objects?
@DestinedToLearn
@DestinedToLearn Жыл бұрын
do you mean a JSON object with more levels? If so use Newtonsoft JSON from asset store (free). If you literally mean JSON in JSON I haven't heard of that so wouldn't have a clue.
@ethnicsovereignty2369
@ethnicsovereignty2369 Жыл бұрын
@@DestinedToLearn I believe the latter. Let's say that you have a library, where there are multiple book categories, each category containing multiple books. The way you'd portray that in JSON (and correct me if I'm wrong) is that you'd have a json object (the libraru), containing multiple JSON objects (the categories) each of which contains other json objects (the books)
@ethnicsovereignty2369
@ethnicsovereignty2369 Жыл бұрын
apologies, I've refactored my code a bit and now I've created a multidimensional array (array of arrays of arrays)
@DestinedToLearn
@DestinedToLearn Жыл бұрын
@@ethnicsovereignty2369 I am not that much of an expert at JSON. I just did enough for my project and then made the video so I didn't forget and that is it. Sorry I don't really know how to help :(
@ethnicsovereignty2369
@ethnicsovereignty2369 Жыл бұрын
@@DestinedToLearn Ah, that's okay, thank you for your time! When I (inevitably) find the answer I'll be sure to post it here in case anybody else needs it
@glennanicoche551
@glennanicoche551 2 жыл бұрын
What if I don't have the "player" layer in the json? Mine goes directly to "name" and "score" of each data.
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
Won't work with the builtin. It is very specific with the layout. The Newtonsoft one in the app stop is more forgiving of the format of the json.
@noveraistiqomah
@noveraistiqomah 3 жыл бұрын
Superb! thanks for this video!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Glad you found it useful :)
@MrFarkasOfficial
@MrFarkasOfficial 3 жыл бұрын
Awesome! Noob question: how would one access the variables in the Player class from in game? How do I access those variables from another script?
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Generally I would do it one of two ways. My normal method is apply it to objects as reading in the data. Then you can do it from that script you read it in from. The second is just create public functions in the reader it script that you can call from another script to get the data. For example public int GetHealth(string type) then in that function search the array for entry of that type and return the health. The individual elements are called by myplayerlist.player[index].health where index is the element in the array you are looking for.
@MrFarkasOfficial
@MrFarkasOfficial 3 жыл бұрын
@@DestinedToLearn excellent. Thank you very, very much!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@MrFarkasOfficial Good luck. In a few weeks I will have a bigger JSON example because it is my most watched video. It will be a little level editor with save/load functionality.
@MrFarkasOfficial
@MrFarkasOfficial 3 жыл бұрын
@@DestinedToLearn then you've got my sub. Keep up the good work.
@michaelsander2878
@michaelsander2878 2 жыл бұрын
@@DestinedToLearn I don't understand most of what you are saying in this reply. "apply it to objects as reading in the data." I don't understand how to do this. I'm such a newbie. I really wish I understood this better, but static and non-static and serializable are all very confusing to me still.
@alexandermrcrew
@alexandermrcrew 2 жыл бұрын
I would like to know how you display all that information on the scene view.Thanks
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
for is you had ui text it would be something like mytext.text = player[0].name to display the name of the first player
@bulentgercek
@bulentgercek 3 жыл бұрын
Thanks for great help. It worked. But I have a problem if I call this script from other script in the same object with the GetComponent method, all the data is in the myPlayerList going null. Any ideas? Thanks again.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
That is strange indeed, I don't see what the difference would be. Have you tried putting a debug.log in the original script on the function you are calling to make sure it is being called. Happy to have a quick look if you use pastebin to share scripts.
@jupa1336
@jupa1336 2 жыл бұрын
Hi, great stuff, but do you know how to find a word in all json docs and rename it through all files? My usual solution with .cs files does not work with visual studio (search all files, rename..).. thank you
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
take a look at my profanity filter tutorial and combine it my read file and write file tutorials. First read the file in, then use the replace from the profanity filter to change the word and finally write the file back.
@Lapraniteon
@Lapraniteon 3 жыл бұрын
This was great! Thanks!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
thanks for letting me know, i appreciate it. I am glad it helped!
@artsam7617
@artsam7617 2 жыл бұрын
You saved me
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
glad it helped
@coolkidllama1483
@coolkidllama1483 11 ай бұрын
why not use a json file and put json text in a text file?
@DestinedToLearn
@DestinedToLearn 11 ай бұрын
you can use the .json extension, it works fine. I recorded the tutorial in one take and probably should have done that in hindsight.
@maucazalv903
@maucazalv903 Жыл бұрын
How can I use this for "Queue" variables? like.. making sure that each each element of a same list got its own string
@DestinedToLearn
@DestinedToLearn Жыл бұрын
I am not quite sure what you mean
@maucazalv903
@maucazalv903 Жыл бұрын
@@DestinedToLearn im not quite sure how to explain it, so I send a tutorial that I followed for a pair of scripts kzbin.info/www/bejne/lZ-1q6KKr8qsrrc Im trying to use the JSON file to fill the viarable "Sentences", which is a Queue class
@DestinedToLearn
@DestinedToLearn Жыл бұрын
@@maucazalv903 I don't have any experience with that but have a look at stackoverflow.com/questions/310167/in-c-how-can-i-serialize-queue-net-2-0 the last comment should work for you. To find more help on it google "serialize Queue unity"
@maucazalv903
@maucazalv903 Жыл бұрын
@@DestinedToLearn thanks
@DestinedToLearn
@DestinedToLearn Жыл бұрын
@@maucazalv903 good luck!
@aguspray
@aguspray 2 жыл бұрын
Hello, I have a question, I do the same thing like what you did. I desereliaze string json from web socket, but I have a problem. json utility always give me an error. I success parse the json when the json like this: string s = "{\"classes\":\"arrayResult\",\"confidences\":\"confidences\",\"data\":\"testing\"}"; => i get this json string by copying rest api result in console. but when I try to parse json from rest api, it will give me error. could you give me some advice/help? thank you so much
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
how are you getting the file from the web? Have you debugged it to make sure it isn't changing the string? I would use unitywebrequest to download it (there is a tutorial on my channel for how to do that).
@aguspray
@aguspray 2 жыл бұрын
@@DestinedToLearn thank you for your answer, my problem is solved. There is an error from web socket server, I did double string casting for data dictionary (1. From json.dumps, 2 from websocket.send_json)
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
@@aguspray glad it was a "simple" fix.
@zanagi
@zanagi 5 ай бұрын
Do I have to system serialize it?
@DestinedToLearn
@DestinedToLearn 5 ай бұрын
I don't think so, but you do it you want to see it in the editor.
@rudyboot543
@rudyboot543 2 жыл бұрын
Hey mate, great video, it got me started. I'm currently trying to read in this sample of json { "actionName": "staff", "values": { "damageAmount": 30, "maxActionDistance": 7 } } but unity automatically flattens it... also the properties under values are all a custom type in my game which is also leading to problems, do you have any ideas? thanks
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
Use newtonsoft JSON from appstore, it is free and the syntax is basically the same but handles a much wider range of JSON
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
from asset store
@jonathanjennings1168
@jonathanjennings1168 3 жыл бұрын
Great video!!!!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
thanks i am glad you liked it
@rajatbhalla1455
@rajatbhalla1455 3 жыл бұрын
Myplayerlist is not showing in the UNITY. Please help me its urgent.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
did you put [system.Serializable] above it?
@rajatbhalla1455
@rajatbhalla1455 3 жыл бұрын
@@DestinedToLearn yes it solved the problem thank you.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@rajatbhalla1455 No worries :)
@jettmendoza7043
@jettmendoza7043 3 жыл бұрын
how to return the edited values from unity to json text?
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
Check my writing to JSON tutorial
@user-gb6vn5kv5w
@user-gb6vn5kv5w 3 жыл бұрын
Thank you 🥺
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
you are welcome :)
@shonia3204
@shonia3204 3 жыл бұрын
Thank u, bro!
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
you are most welcome :). Thanks for watching.
@yakanashe
@yakanashe Жыл бұрын
The playerlist doesn't get updated on launch?
@DestinedToLearn
@DestinedToLearn Жыл бұрын
think you might have a mistake then because it does for me
@DestinedToLearn
@DestinedToLearn Жыл бұрын
Actually for you mean if you make changes they aren't saved? If you want to save have a look at my writing JSON tutorial which shows you how to go the other way.
@yakanashe
@yakanashe Жыл бұрын
@@DestinedToLearn well after 1 hour of debugging, I found out it was reading the JSON, but the JSON file is capitalized. And it's not in my script. But it works now and I got the text file running on a server right now. So I can edit the fields wherever I am
@DestinedToLearn
@DestinedToLearn Жыл бұрын
@@yakanashe don't feel bad, we all have moments like in coding. I have had much worse myself.
@yakanashe
@yakanashe Жыл бұрын
@@DestinedToLearn haha thanks :)
@bigmancozmo
@bigmancozmo 3 жыл бұрын
HOW THE FRICK DID I ALREADY KNOW HE WAS GONNA SAY TO MAKE A SCRIPT CALLED JSONREADER I PAUSED IT AT THE START AND RANDOMLY MADE A FILE CALLED JSONREADER
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
because you can read minds
@partumorbis4481
@partumorbis4481 Жыл бұрын
Hi! Thanks a lot It is realy nise and smooth Can you help please with the 'next step', when I want to transfer data from one script to another? Case: I have two JSON sources, both of them store some information First one keep current data And second one general leveling data When i parse both data i use Class for each of JSON files into two different scripts. Later I need to put level info (like stats for level 1 or 2 or later on), to current data and i see the error that I can not do it, like: MySpawnerData.CurrentLevelingData = LevelingReader.myLevelData.Leveling[0].LevelingData; Even when LevelingData and CurrentLevelData are tottaly same What could be a solution? Thanks a lotin advance!
@DestinedToLearn
@DestinedToLearn Жыл бұрын
what is the error?
@partumorbis4481
@partumorbis4481 Жыл бұрын
Solution Found: (I used struct instead of class) Thanks! ​@@DestinedToLearn CS0029 Unknown implicitly converted type "LevelingReader.LevelingData" into "SpawnerReader.LevelingData". (text is translated from other language, so some words could be different)
@partumorbis4481
@partumorbis4481 Жыл бұрын
There are 2 same classes for parsing purposes in 2 different scripts. [System.Serializable] public class LevelingData { public float Speed; public float Period; public float Height; public float Pair1; public float Pair2; public float Pair3; }
@sauravs1425
@sauravs1425 2 жыл бұрын
How do u do this if u have the link of json file in web
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
use the unitywebrequest class docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.Get.html
@sauravs1425
@sauravs1425 2 жыл бұрын
@@DestinedToLearn Thank you...it worked
@DestinedToLearn
@DestinedToLearn 2 жыл бұрын
@@sauravs1425 Glad you got it figured :)
@clarkmeyer7211
@clarkmeyer7211 Жыл бұрын
very cool but...Your...Poor...Keyboard
@DestinedToLearn
@DestinedToLearn Жыл бұрын
it sounds louder than it really it is! But I actually find the typing satisfying. I can only imagine how loud it would be if I had a mechanical keyboard
@youtuberecommended9183
@youtuberecommended9183 3 жыл бұрын
Good tutorial
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
:)
@youtuberecommended9183
@youtuberecommended9183 3 жыл бұрын
@@DestinedToLearn Nevermind. It works fine my mistake.
@DestinedToLearn
@DestinedToLearn 3 жыл бұрын
@@youtuberecommended9183 No worries glad you fixed your problem. I guessing you had a naming issue. Unity JSON is very unforgiving if everything isn't exactly the way it should be.
Writing to a JSON file - an easy how to with Unity
8:31
Destined To Learn
Рет қаралды 16 М.
AI can't cross this line and we don't know why.
24:07
Welch Labs
Рет қаралды 328 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 712 М.
How to make a Save & Load System in Unity | 2022
26:56
Shaped by Rain Studios
Рет қаралды 191 М.
Better Coding in Unity With Just a Few Lines of Code
15:27
Firemind
Рет қаралды 309 М.
How to ACTUALLY get into Gamedev
14:01
DaFluffyPotato
Рет қаралды 724 М.
Unity using JSON from URL - EASY
25:15
Online Code Coaching
Рет қаралды 26 М.
Unity3D API Request - Get & display data from the internet
9:04
Scott Durkin
Рет қаралды 22 М.
Unity Localization with Automatic Translation and TextMeshPro
16:28
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15