- Home /
I have a class derived from ScriptableObject, and members are getting serialized when I don't want them to be.
I am using a ScriptableObject class for an object that I don't want to be attached to a GameObject in the scene. Some fields change on objects of this type during gameplay, and then persist over different launches of the game, or loads of the level, and I don't want that!
The members that are being serialized are private and are marked as [System.NonSerialized], but the behavior persists. What else can I do to prevent this from happening?
Answer by Ashkan_gc · May 31, 2013 at 09:27 AM
As a hack you can reassign values of the fields that you want to be reset/calculated each time in OnEnable of the script.
Your answer

Follow this Question
Related Questions
Custom assets give Missing (Mono Script) 0 Answers
ScriptableObject stored in MonoBehaviour lost on quit 1 Answer
Difference between assigning a value in inspector and with a custom editor script 1 Answer
How to serialize a concrete derived class from generic ScriptableObject base 1 Answer
How to make a deep copy of a list of ScriptableObject derived types? 1 Answer