Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Where best to place library of json files

Discussion in 'General Discussion' started by taivasltd, Apr 4, 2019.

  1. taivasltd

    taivasltd

    Joined:
    Mar 27, 2019
    Posts:
    20
    Hello all,

    Unity noob here.

    As I am building my game, I am following this approach:
    I store static data in many .json files (one .json per room in the game) that hold all the information required, that I can retrieve successfully via FromJson when character enters a room etc etc. I think it helps to maintain a clean directory structure that essentially holds all that info.

    Now in my current version I had this library under Resources, just because when I build the project to test how it looks, the files were visible if I used StreamingAssets.
    I read though in Unity docs that Resources folder is not the recommended way of storing these files for many reasons.

    What is the best way of storing this set of info without all the cons of Resources (like memory sacrifice)? Asset Bundles did not seem to cover what I need right?
     
    Ideator likes this.
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If they are to be shipped as part of the game, you can just put them in any other folder under Assets and assign references on some other object via the inspector.

    AssetBundles are intended more for when you want to add content outside of the build (keep build size small for initial install then have it download all the large models/textures from AssetBundles), but JSON files are unlikely to need this unless you want to provide a way to send updates to these without putting out a new build.
     
    Ideator and karl_jones like this.
  3. taivasltd

    taivasltd

    Joined:
    Mar 27, 2019
    Posts:
    20
    Ah ok so any folder under Assets would do e.g. Assets/RoomDataLibrary/....

    Great thanks so much, for some reason I thought it should be one of the 3 predefined folders :p