# GetIcon()

> Gets the icon to associate with the imported MonoScript.

## Definition

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

```csharp
public Texture2D GetIcon()
```

### Returns

| Type                                                                  | Description                                                                                                                                                                                                                                                                              |
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Texture2D](/engine/6000.0/script-reference/unityengine/texture2d.md) | Returns the custom icon that will be associated with the imported [MonoScript](/engine/6000.0/script-reference/unityeditor/monoscript.md). If no custom icon will be associated with the imported [MonoScript](/engine/6000.0/script-reference/unityeditor/monoscript.md), returns null. |

### Remarks

Additional Resources: [MonoImporter.SetIcon](/engine/6000.0/script-reference/unityeditor/monoimporter/seticon.md), [EditorGUIUtility.GetIconForObject](/engine/6000.0/script-reference/unityeditor/editorguiutility/geticonforobject.md).

### Examples

```csharp
using UnityEngine;
using UnityEditor;

class Example
{
    [MenuItem("Examples/Get Icon for MonoScript from MonoImporter")]
    public static void GetIconForMonoScriptFromMonoImporter()
    {
        var assetPath = "Assets/MyMonoBehaviour.cs";
        var monoImporter = AssetImporter.GetAtPath(assetPath) as MonoImporter;
        var icon = monoImporter.GetIcon();
        Debug.Log($"Icon for {assetPath} is {icon}");
    }
}
```
