Search Unity

Question about scriptable object instance

Discussion in 'Prefabs' started by rangolee302, Jun 17, 2021.

  1. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    Hi all,
    I just wondering what if I create a scriptable object SO in Resource/. Lets say it hold a variable currentLevel.
    I set currentLevel in inspector to 0 and build. At run time of the build currentLevel is set to 2 by a script that holds the reference of SO. Will currentLevel be 2 next time I start the build? If so, Is that mean I can treat it as a save data?
     
  2. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    It will in the editor, but not in a build of your game.
     
    rangolee302 likes this.
  3. No. SOs are assets just like for example materials. So they retain changes in the editor, but they do not retain changes in build between sessions.
     
    rangolee302 likes this.