First, as DMGREGORY wrote in a remark, an inherited class of ScriptableSingleton
I ought to have itself just like the generic parameter for ScriptableSingleton
No different class. Then the category declaration ought to most likely be:
public class TestSaver : ScriptableSingleton
(I am unsure what class is Take a look at
He does it in his mission, since you didn’t publish it. But when it comprises the state that you just wish to persist, then that ought to most likely transfer to TestSaver
. Or perhaps it ought to be referenced by TestSaver
).
Then there may be one other downside. As The documentation for ScriptableSingleton
says:
As well as, if the category makes use of defiapathattribute, serializable information persists between unity periods.
What does “serializable information” imply? That is defined in The guide part on serialization. However the TL model; Dr is that if you would like the Singleton variables to serialize within the file for persistence, then you need to declare them as public
or mark them with him (SerializeField)
attribute.
See the official instance within the scriptableingleton documentation. You’ll discover that they added this attribute to all of the variables that wish to persist.
So altering the road
non-public string testValue;
To this:
(SerializeField) non-public string testValue;
I ought to do the trick.