I am trying to make a custom script that allows to spawn prefabs from the editor (without enetering play mode). In this editor there is a field like this:
Vector3 spawnPosition = Vector3.zero;
Whenever I change the focus on the script, or I click play or stop, the field gets reset.
I have been looking on the internet and the clasic solutions doesn’t seem to work anymore. Examples:
- Adding [SerializeField] to the
- Adding [System.Serializable] the the class
- Removing = Vector3.zero; from the declaration
- Invoking EditorUtility.SetDirty(target);
- Since the variables are from the custom editor and not the script,
this doesn’t work neither:
The class works fine but the custom variables get reset all the time which is very anoying.
Did anyone else run into the same problem?