Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

What are the major benefits of JSONUtility usage?

Discussion in 'Scripting' started by jeremy_crowell, Sep 16, 2018.

  1. jeremy_crowell

    jeremy_crowell

    Joined:
    Jul 21, 2018
    Posts:
    11
    Hello,

    If I have a bunch of game items, let's say 60 items with different properties(e.g. weight, color, sound and etc) do I need to save them in json or I can keep them in array without serialization?

    What benefit I will get if I save array of 60 objects in json? I suppose it's just a question of space, right?

    Thank you in advance
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    1,682
    If you're not saving and loading them, there's little difference. At some point you're going to have to turn the data into "real" objects anyways.
     
    jeremy_crowell likes this.
  3. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    636
  4. jeremy_crowell

    jeremy_crowell

    Joined:
    Jul 21, 2018
    Posts:
    11

    Yap, just came across this situation a little bit later after I posted the question. Without serialization I can't save and load them. Thanks for your confirmation.
     
  5. jeremy_crowell

    jeremy_crowell

    Joined:
    Jul 21, 2018
    Posts:
    11
    Update. I didn't know that unity doesn't support serialization of array. It's really weird. Such a big engine and I need to use external class to serialize my array of custom objects.
     
    rakkarage likes this.