Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Dealing with Scriptable Object flaw for years!!!

Discussion in 'Editor & General Support' started by georgeq, Oct 2, 2021.

  1. georgeq


    Mar 5, 2014
    I've been using Scriptable Objects since... I don't know, Unity 5 maybe?... And I've been dealing with this flaw ever since:

    I create a Scriptable Object asset, everything works fine, days later (after project reload) l add code and content, values still persist upon project reloads, but if I iterate several times updating code, modifying values, and reloading the project, there's a point at which values do not persist anymore, once I close Unity, values are lost and replaced with an old version. Once that point is reached there's no possible way to keep even the smallest data change on that assets, after closing Unity everything is lost. The only solution for that is to delete the asset, create a new one, and patiently fill every piece of data manually one by one, which sometimes is a major problem.

    Just yesterday I have to fully remake a module because my boss was unable to see my changes on his copy, simply because data on Scriptable Objects is not saved properly.

    I really do not understand why no one at Unity has noticed this problem nor done anything to fix it. It's been years!!! half a decade at least!!! and no one has done anything!!!

    I don't think I'm the only one having this problem, so please do something!!!
  2. spiney199


    Feb 11, 2021
    I would assume you're checking the scriptable asset file by opening it in notepad or similar to see what data has been written to disk, and whether that matches the data from your most recent session? The only situations that I've noticed where data on my scriptable object reverts or disappears between Editor sessions is because the data either wasn't being serialized, or I had editor scripts to populate data and forgot to use EditorUtility.SetDirty to mark the SO for saving.

    Otherwise I've not encountered this issue with scriptable objects despite having hundreds in my current project.
    Kurt-Dekker likes this.
  3. Kurt-Dekker


    Mar 16, 2013
    Weird... like Spiney above, I have NOT seen this. And I use SOs a LOT, as does our team. We have a HUGE hierarchy of perhaps 80-90 interlinked SOs that make up our program state.

    We are also using source control constantly (git of course, see below), without exception checking in and monitoring every change to my SOs, and I have never seen anything unexplained get changed.

    If you're not already source controlling, please consider using proper industrial-grade source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    As far as configuring Unity to play nice with git, keep this in mind:

    Here's how I use git in one of my games, Jetpack Kurt:

    Using fine-grained source control as you work to refine your engineering:

    Share/Sharing source code between projects:

    Setting up an appropriate .gitignore file for Unity3D:

    Generally setting Unity up (includes above .gitignore concepts):

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards