Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    30
    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,844
    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:
    669
  4. jeremy_crowell

    jeremy_crowell

    Joined:
    Jul 21, 2018
    Posts:
    30

    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:
    30
    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.