# GetDefaultReference(string)

> Gets the default value for a reference field in the imported MonoScript.

## Definition

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

```csharp
public Object GetDefaultReference(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of a public field in the imported [MonoScript](/engine/6000.5/script-reference/unityeditor/monoscript.md).

### Returns

| Type                                                            | Description                                                               |
| --------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [Object](/engine/6000.5/script-reference/unityengine/object.md) | The Unity object to use as a default value for the given reference field. |

### Remarks

Additional Resources: [MonoImporter.SetDefaultReferences](/engine/6000.5/script-reference/unityeditor/monoimporter/setdefaultreferences.md).

### Examples

```csharp
using UnityEngine;
using UnityEditor;

class Example
{
    [MenuItem("Examples/Get Default Reference")]
    public static void GetDefaultReference()
    {
        var assetPath = "Assets/MyMonoBehaviour.cs";
        var monoImporter = AssetImporter.GetAtPath(assetPath) as MonoImporter;
        var value = monoImporter.GetDefaultReference("MyGameObject");
        Debug.Log($"Default reference for MyGameObject in {monoImporter.GetScript().GetClass().FullName} is {value}");
    }
}
```
