Hi everyone,
at the moment i’m working on a data structure that uses Scriptable Objects to store data which gets generated by editor scripts and property drawers.
The problem is, that all the generated Data gets wiped when I restart Unity. So I need a salution for that.
I have 2 classes and two editor scripts at the moment.
Class A is a normal Monobehaviour which just holds a reference to an object of Class B and has a specific private Method.
Class B is a Scriptable Object which holds a bool and 4 System.Type variables (i use a wrapper class for the Types so they are Serializable and don’t get wiped everytime I compile my scripts)
Now it gets tricky:
My first Editor Script is a Property Drawer for Class B. It shows a Button inside the Inspector which you can press to generate Data from the script which holds the reference to Class B.
When I press the Button, the Property Drawer scans the Script holding the Reference (in this case Class A) for the specific private Method using Systems.Reflection and stores the Type of its max. 4 Parameters in the 4 Type variables of its referenced Object of Class B. Also it sets the bool of that Object to true.
This all works perfectly and I have some Debug-Logs and some Labels in the Inspectors to show what happend so I can validate the Data.
So I know this part works. The problem now is, that the bool and all 4 Types of that object of Class B get wiped when I restart Unity. The really interesting thing about this is, if I manually change that bool to true, it stays the same even after restarting Unity, which confuses me extremly.
Can somebody tell me why this happens, and more importantly how I can fix that?
Oh btw. that last editor script is just a custom editor for Class B that shows me a reset Button, so I can reset the generated Data. This also works perfectly, but the generated data gets wiped when restarting Unity too.
Thanks in advance