Hello,
I’m developping an Editor script which modifies values of a private parameter in OnSceneGUI…
When I want to read the value in OnInspectorGUI, the value is not set to the value I set in OnSceneGUI…
What am I missing?
Thanks
Hello,
I’m developping an Editor script which modifies values of a private parameter in OnSceneGUI…
When I want to read the value in OnInspectorGUI, the value is not set to the value I set in OnSceneGUI…
What am I missing?
Thanks
If you’re using the serializedObject value to modify the object, make sure you call Update before reading any values and ApplyModifiedProperties after changing any values. Those ensure your objects are properly in sync and changes are saved.
This is not a serializedObject, this is a private parameter that is declared in the body of the Editor class and which is modified in OnSceneGUI. When I get into OnInspectorGUI this parameter is still having its default value.
After having called Repaint() in OnSceneGUI my private integer could be updated and I could get the appropriate value in OnInspectorGUI… A bit strange, but good to know!