- Home /
can use resource.load to load levels(json file)?
Hi guys, i made a level builder with untiy (with editor window api) that saves objetcts positions as level in json file
1-Is this okay(this style)?
2-Is it okay to load the levels with resource.load?it will have memory issue?
https://learn.unity.com/tutorial/assets-resources-and-assetbundles#5c7f8528edbc2a002053b5a7
The Resources folder
3.1. Best Practices for the Resources System
Don't use it.
In your situation, I believe there are other ways to handle your JSON file.
I have one question: why do you want to use the Resources folder?
i made a level builder. my level builder will save objects positions... as a json file somewhere "in my case in Resources"
cause after build client able to read it.
can i save in other folder ? and then access it after build?
Note:its not a runtime level maker its a window editor level editor. i want make level and put them in app before user install it
If the file is not meant to be changed after the application has built, then I would store the JSON file in your project outside of any Resources
folder. I think this file will be automatically interpreted as a TextAsset
asset you can edit using functions from the System.IO
namespace.
Check here for more info http://answers.unity.com/answers/1170581/view.html (2nd answer)
Answer by Pharez · Mar 13, 2020 at 10:38 AM
A general rule of thumb when coding is that if you are using a well maintained and professional code like Unity's it will probably work just fine, it's implementing your own solutions to already well solved problems that you should be weary of. Though I am not saying don't solve things yourself just that it is more likely to go wrong than using a good library. So yes, this is fine and in fact if you take a look at the docs, they already have the pattern for loading a JSON file using Resources.Load. Memory is almost never an issue when doing anything on modern computers, as long as your file size doesn't somehow get to gigabytes in size it should be fine. If it does then you will have to do some stuff to manually convert it to an object a little bit at a time probably, but it might just work anyway. I recently used Resources.Load for one of my tools and it worked well.
thanks. what should i do for load prefabs? move all prefabs to Resoureces? make a class and drag all prefabs as list items to that?
Your answer
Follow this Question
Related Questions
Rendering Image Sprites Programatically 0 Answers
Level Editors? 1 Answer
Level managers and editor 0 Answers
Saving a level with the help of prefabs 3 Answers
How should I make this type of text level editor? C# 1 Answer