# OpenFilePanel(string, string, string)

> Displays the "open file" dialog and returns the selected path name.

## Definition

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

```csharp
public static string OpenFilePanel(string title, string directory, string extension)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The text to display in the title bar of the dialog window.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The default file directory that this dialog opens. This parameter is relative to the project directory. For example, "Assets" displays the Assets directory when this dialog opens.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The file extensions to filter in this dialog. Do not precede file extension names with a period. Enter an empty string to include all file types. Separate multiple file extensions with a comma and no space between entries.

### Returns

| Type                                                           | Description                         |
| -------------------------------------------------------------- | ----------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The fully qualified path to a file. |

### Remarks

Additional Resources: [EditorUtility.SaveFilePanel](/engine/6000.3/script-reference/unityeditor/editorutility/savefilepanel.md) function.

![EditorUtilityOpenFilePanel (OpenFilePanel(string, string, string))](/api/media?file=/engine/6000.3/media/images/EditorUtilityOpenFilePanel.png)

*Open File Panel.*

### Examples

```csharp
using System.IO;
using UnityEngine;
using UnityEditor;

public class OpenFilePanelExample : EditorWindow
{
    [MenuItem("Example/Overwrite Texture")]
    static void Apply()
    {
        Texture2D texture = Selection.activeObject as Texture2D;
        if (texture == null)
        {
            EditorUtility.DisplayDialog("Select Texture", "You must select a texture first!", "OK");
            return;
        }

        string path = EditorUtility.OpenFilePanel("Overwrite with png", "", "png");
        if (path.Length != 0)
        {
            var fileContent = File.ReadAllBytes(path);
            texture.LoadImage(fileContent);
        }
    }
}
```
