Firstborn/Assets/ModTool/ModTool.Editor/CodeSettingsEditor.cs
Schaken-Mods 7502018d20 Adding Mod Support
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
2023-05-13 22:01:48 -05:00

42 lines
1.4 KiB
C#

using UnityEngine;
using UnityEditor;
using ModTool.Shared;
using UnityEditorInternal;
namespace ModTool.Editor
{
[CustomEditor(typeof(CodeSettings))]
public class CodeSettingsEditor : UnityEditor.Editor
{
private SerializedProperty inheritanceRestrictions;
private SerializedProperty memberRestrictions;
private SerializedProperty typeRestrictions;
private SerializedProperty namespaceRestrictions;
void OnEnable()
{
inheritanceRestrictions = serializedObject.FindProperty("_inheritanceRestrictions");
memberRestrictions = serializedObject.FindProperty("_memberRestrictions");
typeRestrictions = serializedObject.FindProperty("_typeRestrictions");
namespaceRestrictions = serializedObject.FindProperty("_namespaceRestrictions");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true));
EditorGUILayout.PropertyField(inheritanceRestrictions, true);
EditorGUILayout.PropertyField(memberRestrictions, true);
EditorGUILayout.PropertyField(typeRestrictions, true);
EditorGUILayout.PropertyField(namespaceRestrictions, true);
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
}
}
}