0
\$\begingroup\$

I've been working on a mobile game that uses the same framework for each level in the game, and I was wondering what would be the most efficient way to store all those levels in Unity. Should I only use one scene and save all the level data somewhere in the filesystem so that each level can be loaded on demand? Or, should each level have its own scene in Unity? Or is there another, more efficient way to do this?

I just worry that creating multiple scenes with nearly identical assets will take up far too much memory and space on someone's device for such a simple game, but I can't figure out a better way to do it. Any ideas?

\$\endgroup\$
9
  • \$\begingroup\$ Both approaches will work. Have you profiled the amount of extra space another scene adds to verify whether this is going to be a significant problem for your goals? \$\endgroup\$ Commented May 18, 2020 at 23:56
  • \$\begingroup\$ Given that this is a mobile game, minimal space is certainly ideal. The size of a scene compared to the size of a json that represents that same scene setup is about 50 times the file size of the json representation on average in my project. My biggest issue with using json files is that, when the game is built, how will I access those json files via script without letting the user of the phone modify them. \$\endgroup\$ Commented May 19, 2020 at 0:14
  • \$\begingroup\$ If they're stored as TextAssets in your Unity project, they should get built into your game's resource files rather than being stored as individual plaintext files, which might be enough for your needs. But that's a different question. \$\endgroup\$ Commented May 19, 2020 at 0:22
  • \$\begingroup\$ Oh okay, I've always heard that loading from Resources isn't the best idea but, the more I think about it, the more I realize that the size of the JSON file is very small so it shouldn't matter too much. Thank you! \$\endgroup\$ Commented May 19, 2020 at 0:34
  • \$\begingroup\$ You don't need to load from resources, you can just store a reference to the TextAsset you want. \$\endgroup\$ Commented May 19, 2020 at 0:44

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.