# GetTypesDerivedFrom

> Retrieves an unordered collection of types derived from the T type.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## GetTypesDerivedFrom\<T>()

Retrieves an unordered collection of types derived from the **T** type.

```csharp
public static TypeCache.TypeCollection GetTypesDerivedFrom<T>()
```

### Returns

| Type                                                                                      | Description                                                                                                                  |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) | Returns an unordered collection of derived types. If assemblyName is specified, returns only types defined in this assembly. |

### Remarks

This method provides fast access to all classes loaded from a given assembly or all Unity domain assemblies, which are derived from a specific class or implement a specific interface. Base class or interface can be a generic. The order of results is undefined.

```csharp
using UnityEditor;

public class Example
{
    static void ScanAssetPostprocessors()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<AssetPostprocessor>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

Or classes which implement a specific interface.

```csharp
using UnityEditor;

public interface IExampleInterface {}

public class Example
{
    static void ScanInterfaceImplementers()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<IExampleInterface>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

**Note:** The returned [TypeCache.TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) is read-only and thread-safe. The order of types in the collection is undefined.

## GetTypesDerivedFrom(Type)

Retrieves an unordered collection of types derived from the **T** type.

```csharp
public static TypeCache.TypeCollection GetTypesDerivedFrom(Type parentType)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): Type of a class or interface.

### Returns

| Type                                                                                      | Description                                                                                                                  |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) | Returns an unordered collection of derived types. If assemblyName is specified, returns only types defined in this assembly. |

### Remarks

This method provides fast access to all classes loaded from a given assembly or all Unity domain assemblies, which are derived from a specific class or implement a specific interface. Base class or interface can be a generic. The order of results is undefined.

```csharp
using UnityEditor;

public class Example
{
    static void ScanAssetPostprocessors()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<AssetPostprocessor>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

Or classes which implement a specific interface.

```csharp
using UnityEditor;

public interface IExampleInterface {}

public class Example
{
    static void ScanInterfaceImplementers()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<IExampleInterface>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

**Note:** The returned [TypeCache.TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) is read-only and thread-safe. The order of types in the collection is undefined.

## GetTypesDerivedFrom\<T>(string)

Retrieves an unordered collection of types derived from the **T** type.

```csharp
public static TypeCache.TypeCollection GetTypesDerivedFrom<T>(string assemblyName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional assembly name.

### Returns

| Type                                                                                      | Description                                                                                                                  |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) | Returns an unordered collection of derived types. If assemblyName is specified, returns only types defined in this assembly. |

### Remarks

This method provides fast access to all classes loaded from a given assembly or all Unity domain assemblies, which are derived from a specific class or implement a specific interface. Base class or interface can be a generic. The order of results is undefined.

```csharp
using UnityEditor;

public class Example
{
    static void ScanAssetPostprocessors()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<AssetPostprocessor>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

Or classes which implement a specific interface.

```csharp
using UnityEditor;

public interface IExampleInterface {}

public class Example
{
    static void ScanInterfaceImplementers()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<IExampleInterface>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

**Note:** The returned [TypeCache.TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) is read-only and thread-safe. The order of types in the collection is undefined.

## GetTypesDerivedFrom(Type, string)

Retrieves an unordered collection of types derived from the **T** type.

```csharp
public static TypeCache.TypeCollection GetTypesDerivedFrom(Type parentType, string assemblyName)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): Type of a class or interface.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional assembly name.

### Returns

| Type                                                                                      | Description                                                                                                                  |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) | Returns an unordered collection of derived types. If assemblyName is specified, returns only types defined in this assembly. |

### Remarks

This method provides fast access to all classes loaded from a given assembly or all Unity domain assemblies, which are derived from a specific class or implement a specific interface. Base class or interface can be a generic. The order of results is undefined.

```csharp
using UnityEditor;

public class Example
{
    static void ScanAssetPostprocessors()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<AssetPostprocessor>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

Or classes which implement a specific interface.

```csharp
using UnityEditor;

public interface IExampleInterface {}

public class Example
{
    static void ScanInterfaceImplementers()
    {
        var extractedTypes = TypeCache.GetTypesDerivedFrom<IExampleInterface>();
        foreach (var editors in extractedTypes)
        {
            //...
        }
    }
}
```

**Note:** The returned [TypeCache.TypeCollection](/engine/6000.0/script-reference/unityeditor/typecache/typecollection.md) is read-only and thread-safe. The order of types in the collection is undefined.
