- Home /
Modifying object data from OnSceneGUI
I have a custom editor that uses OnSceneGUI to watch for a click in the sceneview, and modifies the component being edited when there is a click in a certain area. I have two questions about this:
1) If I want to modify serialized fields when this click occurs, how do I achieve that? It seems I would want to use SerializedObject, but Unity specifically prohibits this in OnSceneGUI.
2) When I modify a non-serialized field, I find that the object doesn't get redrawn right away. I added an Undo.RecordObject call (and the undo functionality is working), but the object still doesn't get redrawn. The only way I can get it to redraw is to use EditorUtility.SetDirty, which the docs say I shouldn't have to do. What is up here?
Your answer
Follow this Question
Related Questions
Editor changes lost when entering Playmode 0 Answers
Custom Editor serializing data in prefab instance. 0 Answers
Custom Editor changes value of other scripts 1 Answer
EditorWindow: How to Serialize variables after PLay 1 Answer
CustomEditor for an ScriptableObject asset only works after recompile. 1 Answer