Scriptable Object only useable from code, not via inspector

Hello everyone,

I have a rather simple Scriptable Object which looks like this:

What works is that I can change the values from within my code and they are saved and used as expected.

However, what does not work anymore is that the values shown in the inspector do not change if the values are changed within the code and the other way round: If I change the values in the inspector during runtime this has no effect.


Can somebody tell me what goes wrong?

Extra question (but above is way more important): Visual Studio tells me that the gameHasEnded variable is “assignd but never used” (see first screenshot). However, below you see that it has 3 references and it is used. I did not figure out how to get rid of it.

Are you sure you reference the same scriptable object?

However, below you see that it has 3 references and it is used

No they aren’t. The properties you have are auto properties and don’t use the private field. This is most likely the source of your main problem BTW.

public bool NewLevelLoaded
    get => newLevelLoaded;
    set => newLevelLoaded = value;    

Note that this kind of property is almost useless. a direct public field would do the exact same job.

oh yes, I see…
I read about these auto properties but assumed that they are only generated if no private fields are defined. Obviously, this is not the case :wink:

Thanks a lot for your help! At the end the solution is very easy if you know the reason :slight_smile: