static Main() { list = new List <EditorEnhancement>(); // find all classes which derive from EditorEnhancement // and create an instance of each one Type tEnhancement = typeof(EditorEnhancement); Assembly a = Assembly.GetAssembly(tEnhancement); foreach (Type type in a.GetTypes()) { if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(tEnhancement)) { EditorEnhancement e = (EditorEnhancement)Activator.CreateInstance(type); list.Add(e); } } // enable all those which are actually enabled foreach (EditorEnhancement e in list) { if (EditorPrefs.GetBool(e.Prefix + "_Enabled", true)) { e.OnEnable(); } } }
public int this[EditorEnhancement pFor, string pName, int pDefault = 0] { get { return(EditorPrefs.GetInt("EE_" + pFor.Prefix + "_" + pName, pDefault)); } set { EditorPrefs.SetInt("EE_" + pFor.Prefix + "_" + pName, value); } }
public bool this[EditorEnhancement pFor, string pName, bool pDefault = false] { get { return(EditorPrefs.GetBool("EE_" + pFor.Prefix + "_" + pName, pDefault)); } set { EditorPrefs.SetBool("EE_" + pFor.Prefix + "_" + pName, value); } }