How to use EditorUtility.OpenFilePanel to filiter multi extensions?

I want to use EditorUtility.OpenFilePanel to open audio files, but it contains only one extension parameter.
I have tried “mp3;ogg”, “mp3|ogg”, “.mp3;.ogg”, “.mp3|.ogg”, but they all failed.
So is this function possible to filiter multi extensions?

If anyone is still interested in a solution for this, using comma separators worked for me :
EditorUtility.OpenFilePanel(“Select Image”, dir, “png,jpg,jpeg,tif,tiff,gif,bmp”)

Use the other method

EditorUtility.OpenFilePanelWithFilters

   /// <summary>
    ///   <para>Displays the "open file" dialog and returns the selected path name.</para>
    /// </summary>
    /// <param name="title">Title for dialog.</param>
    /// <param name="directory">Default directory.</param>
    /// <param name="filters">File extensions in form { "Image files", "png,jpg,jpeg", "All files", "*" }.</param>
    public static string OpenFilePanelWithFilters(string title, string directory, string[] filters)

You have to specify with “*” so use "*.mp3;*.ogg;".

Works fine for me.

maybe can try :
“extension1;*.extension2;*.extension3”

the first don’t add “*.”
the last don’t add “;”

like “jpg;*.jpeg”

:slight_smile:

Answered here !

For those still in need of a solution to this issue, use this format for your filters string array (C#):

string filters = new string { “FBX File”, “fbx” };

Note: each file type must be included as a PAIR. For FBX, you use two strings, one for the display name of the filter and one for the actual file extension (without the period).

Another example:

string filters = new string { “PNG Files”, “png”, “JPG Files”, “jpg”, … };

Just use the semicolon:

.mp3;.ogg