Skip to content

AdjustSettings ScriptableObject is not saved after settings change #196

@hdemmer

Description

@hdemmer

Using v4.23.1.
The new AdjustSettings ScriptableObject is not written to disk after toggling anything on it.

Unity keeps the object in memory and the "Toggle ..." menu options change values (e.g. isiOS14ProcessingEnabled) on the memory instance but this is not actually saved until you save the current scene or project.

Even worse the "Check ..." menu options will report the unsaved value from memory.

This is at least confusing (because source control will not pick the change up until saved) or even dangerous (Unity crashes: the change will be lost).

You should not keep an Instance of the object in memory at all, imho. Load it the moment you want to read or change a value. Then save it if there were changes and unload the object.

So:

var instance = (AdjustSettings)AssetDatabase.LoadAssetAtPath("Assets/Adjust/Editor/AdjustSettings.asset", typeof(AdjustSettings));
// ... read or write value here

// if a value was changed:
EditorUtility.SetDirty(instance);
AssetDatabase.SaveAssets();

For now the workaround is to manually save the project (or scene) after changing the value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions