monopoly/Assets/Mirror/Editor/Logging/NetworkLogSettingsEditor.cs
2020-11-30 08:12:07 +00:00

32 lines
945 B
C#

using Mirror.Logging;
using UnityEditor;
namespace Mirror.EditorScripts.Logging
{
[CustomEditor(typeof(NetworkLogSettings))]
public class NetworkLogSettingsEditor : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
NetworkLogSettings target = this.target as NetworkLogSettings;
if (target.settings == null)
{
LogSettings newSettings = LogLevelsGUI.DrawCreateNewButton();
if (newSettings != null)
{
SerializedProperty settingsProp = serializedObject.FindProperty("settings");
settingsProp.objectReferenceValue = newSettings;
serializedObject.ApplyModifiedProperties();
}
}
else
{
LogLevelsGUI.DrawLogFactoryDictionary(target.settings);
}
}
}
}