Reflection Helpers
Assemblies
Alias of
System.AppDomain.CurrentDomain.GetAssemblies().ToList();
Types / GetAllTypes()
Gets Types of the current domain
foreach (var type in ReflectionHelpers.Types) {
...
}
GetAllTypes(System.Type parent)
Gets all assignables or subclass of a Type
foreach (var type in ReflectionHelpers.GetAllTypes(ColorMatrixPlugin)) {
...
}
GetType
Get type from a complete name "mynamespace.MyType"
ReflectionHelpers.GetType("UnityEngine.ParticleSystemRenderer");
ClassExists
Returns true if the class exists
if (ReflectionHelpers.ClassExists("UnityEngine.ParticleSystemRenderer")) {
...
}
NamespaceExists
Returns true if the namespace exists
if (ReflectionHelpers.NamespaceExists("UnityEngine")) {
...
}
IsInherited
IsSubclassOf + IsAssignableFrom + test generic
if (ReflectionHelpers.IsInherited(typeof(target), typeof(parent))) {
...
}