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. Dismiss Notice

Question Is it better to use JSON or scriptable objects if you wanted to patch your game later?

Discussion in 'Scripting' started by noobsiren, Jun 21, 2023.

  1. noobsiren

    noobsiren

    Joined:
    Apr 3, 2022
    Posts:
    27
    Hi all,

    Been scouring the internet out of curiosity but couldn't really find an answer.

    Just wondering if I were to finish a monster battler game and launch it only to realize monster "x" is way too strong, what would be the best way to go about storing the monsters data?

    For example, currently I am just messing around and using scriptable objects to store all their data, but I've read that data persistence for scriptable objects does not continue when the game is closed and re-launched.

    In that situation, would it be best to disregard scriptable objects and just use JSON to hold all their data?

    More of a hypothetical/curious question as I am currently just playing around with both, but don't really have the experience to tell which one would be best in a use case like that.
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Your concern doesn't seem to be related to your problem. Yes scriptable objects don't hold state between sessions - no asset does. But that doesn't seem relevant to patching games, where you would just modify the relevant assets/code, do a new build, release the build via whatever platform you're on.

    I definitely wouldn't disregard scriptable objects as they're the best way to store and author immutable data in Unity.
     
    noobsiren likes this.
  3. noobsiren

    noobsiren

    Joined:
    Apr 3, 2022
    Posts:
    27
    You just blew my mind spiney. So that's how patching works in game dev? You just make a new build of your game with the changes you made and put it on the platform?

    Excuse my noob questions, not a tech guy lol, but I really enjoy working with unity and making these small games, hoping to make a bigger one eventually.
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    In the most basic sense yes. It depends on your type of game, the type of platform you're publishing onto (and what publishing service you're using), what exactly you're updating, how you manage your content (asset bundles, addressables, xml files, etc), etc etc.

    So you could have all your monster data as JSON files that get imported on application start, so a balance update might just need to push an updated file. Though this does make it very easy for players to edit these files (though you could store than as binary files), and not having the data readily available in the editor might slow down production. Just all various pros and cons in the end.
     
    Last edited: Jun 21, 2023
    CodeSmile likes this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    You should make as many cool fun little games as you can... and you should update them frequently!

    I do this in addition to my professional job and find that it helps keep my mind sharp and frosty when using Unity.

    I also find that it's often just easier to make an update than to try and late patch your game. Making and getting a build qualified is easy, especially when it's just a hobby project.

    Just go do it, do it a lot, have as much fun as you can humanly cram into the experience!

    This guy is my hero of iterative gamedev:

    Imphenzia: How Did I Learn To Make Games:

     
    noobsiren likes this.