// padding
private void OnGUI()
{
// Try to create the editor object if it hasn't been initialized.
if (editor == null)
{
editor = UnityEditor.Editor.CreateEditor(EM_Settings.Instance);
}
// If it's still null.
if (editor == null)
{
EditorGUILayout.HelpBox("Coundn't create the settings resources editor.", MessageType.Error);
return;
}
EM_SettingsEditor.callFromEditorWindow = true;
EM_SettingsEditor.width = position.width;
EM_SettingsEditor.height = position.height;
editor.DrawHeader();
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
EditorGUILayout.BeginVertical(new GUIStyle()
{
padding = new RectOffset(left, right, top, bottom)
});
editor.OnInspectorGUI();
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
EM_SettingsEditor.callFromEditorWindow = false;
}