Contents
What to do if custom editor is not saving changes?
You could try to do a typical Serializable class instead that looks like two dimensional array (class with a list of arrays) and then draw that with your Custom Inspector + serializable object. for every variable you want to change (it also serializes it).
Do you need variables in a custom editor?
To be clear, do you mean variables specifically in the custom editor (fields in the class that extends Editor), or variables in the object being edited? In the former case, you can use EditorPrefs if you absolutely need a value to persist between sessions, though I’ve never seen a situation where that’s necessary in a custom editor.
How to change custom editor variables in Unity?
Lastly if you are changing values in the actual prefab itself (in the project window) you’ll need to call EditorUtility.SetDirty () on the object. I’ve found that using the above methods where appropriate covers all instances where changes need to be persisted by a custom editor.
Why is the Inspector not updating when values are changed?
That is because the fields in the Inspector are serialized and get always overwritten with the serialized values stored in your Scene or Prefab asset. A later change in code of the default value has therefore no effect. So I doubt it has done it before.
Why is my React component not re-rendering?
However when update the toCompare with setToCompare as in the below function – the re-render won’t fire. And moving it to a different component didn’t work either. Only when some other event would fire re-render – did the updated list show up. This was the solution for me.
When are variables not saved with the scene?
When I change the value in the Inspector and save the scene (Without changing anything other). The variable is not saved in the instanced script. JoRouss likes this. In you code sample you should be passing the variable.into the text field, not “”. In you code sample you should be passing the variable.into the text field, not “”. Click to expand…
How long does it take to define a custom component?
You can define customized components that have all the details you need. which you can modify later. Defining a simple custom component typically takes only few minutes. You can invest more time in defining your custom components if you are planning to use them in future projects.