- Home /
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?
I've got exacly the same problem, I want to open .xls and .xlsx files. Did you find a solution to your problem ? Sorry I know its been a year already ...
I've been struggling with this since Unity 3.5, does anyone have anything verified that works?
Answer by tea42 · Sep 09, 2016 at 05:41 PM
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")
Answer by krzysztofuken · May 03, 2018 at 05:08 PM
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)
Answer by KristofR · Aug 23, 2013 at 09:21 AM
You have to specify with "*" so use "*.mp3;*.ogg;"
.
Works fine for me.
This does not work for me, has anyone found anything that does?
I'm trying to open JPEG and JPG files.
I've tried:
".jpg;*.jpeg;"
"\".jpg;*.jpeg;\""
'".jpg;*.jpeg;"' -This errors with single quotes around it
How does yours work? I'm in Unity 4.3 currently.
Answer by ZhongQi · May 09, 2016 at 04:59 PM
maybe can try : "extension1;*.extension2;*.extension3"
the first don't add "*." the last don't add ";"
like "jpg;*.jpeg"
:)
Your answer
Follow this Question
Related Questions
Adding Images 1 Answer
Priority Queue Code Problems 1 Answer
Wierd view 0 Answers
Decorative Pathways 0 Answers