- Home /
ScriptableObject resets on Play
Hi, i have ScriptableObject derived class to store armor for my rpg.
i coded a custom inspector to edit its fields.
But often times, when i drag a texture in a texture field, that field just resets to empty after i hit play.
But it doesn't do it everytime! Just very often.
Any Idea why/ how to fix this?
Are there any prefabs in this equation? Do any scripts potentially set any of the values? Without more information from you it's difficult to provide possible solutions. This kind of thing doesn't usually happen with Unity, and it's likely something that you're doing or not doing that's causing it. Please edit your question to provide as much detail as you can think of that seems relevant to your issue.
this is not my question, i dont even know what he means with the new instance. But i fixed it. I just coded a button into the custom inspector with EditorUtility.SetDirty() and it saves now.
That makes sense. You can, by the way, just call it automatically whenever you change a value. It sounds like you might need it. ;)
Your answer
Follow this Question
Related Questions
NullReferenceException Error 6 Answers
The Variable has not been assigned. 1 Answer
NullReferenceException: Object reference not set to an instance of an object 1 Answer
Losing reference to monobehaviour after updating a dll 0 Answers
Using DestroyImmediate on one GameObject makes a reference to another a null 1 Answer