public static List <Type> GetAllUnityComponents() { if (null == _availableUnityComponents) { var types = GuiReflector.GetAllLoadedTypesAsignableFrom(typeof(Component)); // UnityEngine.Component #if DEBUG if (DebugMode) { StringBuilder sb = new StringBuilder(); if (types.Count == 0) { sb.AppendLine("No styleable classes available."); } else { foreach (Type type in types) { sb.AppendLine(string.Format(" -> {0}", type)); } } Debug.Log(string.Format(@"====== Unity components ====== {0}", sb)); } #endif _availableUnityComponents = types; //Debug.Log("_availableUnityComponents: " + _availableUnityComponents.Count); } return(_availableUnityComponents); }
/// <summary> /// Initializes the Singleton instance /// </summary> private void Initialize() { _allModules.Clear(); //var providerTypes = ReflectionUtil.GetAllLoadedTypesDecoratedWith(typeof (StyleModuleAttribute)); var moduleTypes = GuiReflector.GetAllLoadedTypesAsignableFrom(typeof(StyleModuleBase)); foreach (var moduleType in moduleTypes) { if (moduleType == typeof(StyleModuleBase)) { continue; // skip the abstract class } var module = (StyleModuleBase)Activator.CreateInstance(moduleType); module.ReflectAttribute(); _allModules.Add(module); } }