Why scriptable Object instance modified the Scriptable Object itself ?

Hello,
I have a problem with scriptable object. I have this field:

    private bool built = false;

And a method (i try to implement inside the scriptable and in the Monobehaviour):

    public IEnumerator Build(float delay)
    {
        building.Placed = true;
        yield return new WaitForSeconds(delay);
        built = true;
        SetProduction();
    }

When the method is called from an instantiate clone, that also changes the scriptable object even when i stop the playmode so that affect all next new instantiate objects. How to avoid this behaviour ? I want to use variables like a new standard class.

Thanks for your help :slight_smile:

Because unlike a MonoBehaviour, a ScriptableObject’s data is stored in the Asset.

It behaves just like a Material, PhysicMaterial, or any other assets, when modified at runtime in the Editor, the Asset is not reset when you press stop.

That said, this is only happening when in the Editor.

Assets in Builds are not modified at runtime, and will not be saved from a session to the next.

Although, they are “shared” amongst all instances referencing them, so when you modify it from a MonoBehaviour’s instance, it’s modified for all.
If you want ScriptableObject to be unique, you need to create new instances.