protected void DisableOrNotifyAboutMiscComponents(GameObject go, string nameToUse, params System.Type[] typesToIgnore) { var components = go.GetComponents <Component>(); foreach (var comp in components) { if (comp is Transform) { continue; } if (comp is CanvasRenderer) { continue; } if (comp is Image) { continue; } if (System.Array.Exists(typesToIgnore, t => OSAUtil.DotNETCoreCompat_IsAssignableFrom(t, comp.GetType()))) { continue; } var mb = comp as MonoBehaviour; if (mb) { if (mb.enabled) { Debug.Log("OSA: Disabling unknown component " + mb.GetType().Name + " on " + nameToUse + ". You can enable it back if it doesn't interfere with OSA"); mb.enabled = false; } continue; } Debug.Log("OSA: Found unknown component '" + comp.GetType().Name + "' on " + nameToUse + ". Make sure it doesn't interfere with OSA"); } }
public static void GetAvailableOSAImplementations(List <Type> list, bool excludeExampleImplementations, Type implementedInterface = null, Type withoutImplementedInterface = null) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (var type in assembly.GetTypes()) { if (type.IsAbstract) { continue; } if (!type.IsClass) { continue; } if (type.IsGenericType) { continue; } if (type.IsNested) { continue; } if (type.IsNotPublic) { continue; } if (!CWiz.IsSubclassOfOSA(type)) { continue; } if (excludeExampleImplementations && ( type.Name.ToLower().Contains("example") ////|| type.Name == typeof(Demos.SimpleExample.SimpleTutorial).Name //|| type.Name == "SimpleExample" //|| type.Name == typeof(CustomAdapters.DateTimePicker.DateTimePickerAdapter).Name || type.Name == "DateTimePickerAdapter" )) { continue; } // Excluding TableView's base classes, which will be used automatically if (type.Name == "BasicHeaderTupleAdapter" || type.Name == "BasicTupleAdapter") { continue; } if (implementedInterface != null) { if (!OSAUtil.DotNETCoreCompat_IsAssignableFrom(implementedInterface, type)) { continue; } } if (withoutImplementedInterface != null) { if (OSAUtil.DotNETCoreCompat_IsAssignableFrom(withoutImplementedInterface, type)) { continue; } } list.Add(type); } } }