Search Unity

how do you differentiate between runtime and base data?

Discussion in 'Scripting' started by Rechronicle, Feb 23, 2022.

  1. Rechronicle

    Rechronicle

    Joined:
    Dec 14, 2017
    Posts:
    32
    This 'issue' appears after I use ScriptableObject on a slightly bigger project with a lot of data.
    All of the names start to look kind of similar & clash between runtime/setup data.

    Previously I would just use 'currentHealth' and 'maxHealth' to deal with this.

    Any kind of insight will be helpful.
    Thanks!
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    There is no concept here of "runtime" and "base data" at all. ScriptableObjects are just classes that are serialized by Unity. At runtime you can load them, clone them and edit them. The only thing you can't do automatically is serialize them as Unity's editor does that (same for inspectors etc).

    The serialized data simply lives on the object in the project instead of inside the scene in the project. I kept the explanations simple so I probably missed out some detail that you might need.

    Could you be more specific?
     
    Rechronicle and Bunny83 like this.
  3. Rechronicle

    Rechronicle

    Joined:
    Dec 14, 2017
    Posts:
    32
    Pardon, I think I got the answer shortly after.
    I got it mixed with my old approach on putting every initial data in 1 class. Better treat scriptableObject as a place to clone them instead, the 'runtime class' then keeps track as the game progress (level increase, currentgold, current level progress, etc).
    Then the other class doesn't have business with SO anymore and just goes straight to the 'runtime class'.
    ~~~

    alright, looks like there is no term for data that always changing.
    I just accidentally thought about it because there are these 2 kinds of data laying in my current project, one that stays & one that always changes.