- Home /
Question by
BloodMarked · Dec 05, 2017 at 02:26 PM ·
editor-scriptingeditorwindoweditor windowrendersettings
custom fogColor editorWindow undo problem
i made a custom window which lets me change the fog color, density and other things based on this example https://docs.unity3d.com/Manual/editor-EditorWindows.html
now i want to add undo functionality like this:
EditorGUI.BeginChangeCheck ();
Color newFogColor = EditorGUILayout.ColorField (RenderSettings.fogColor);
float newFogDensity = EditorGUILayout.Slider(RenderSettings.fogDensity, 0, 1);
if(EditorGUI.EndChangeCheck ()){
Undo.RecordObject (RenderSettings, "Fog settings");
RenderSettings.fogColor = newFogColor;
RenderSettings.fogDensity = newFogDensity;
EditorUtility.SetDirty (RenderSettings.fogColor);
}
but it returns this error
Assets/Editor/MyWindow.cs(43,23): error CS0118: `UnityEngine.RenderSettings' is a `type' but a `variable' was expected
(line 7 and 10 here)
how can i solve this? this confuses me completely. is it not possible to undo record rendersettings?
Comment