File Explorer - Unity Package
A downloadable tool
Ever wanted to let your users have access to the Windows File Explorer but gotten intimidated by the giant github repositories? No worries, me too.
This is my little gift to you...
Explorer Tool is a package I made that is designed to make opening the Windows OS File Explorer, and getting usable data out of it, easy.
Like my other projects I have tried to make the developer experience as smooth as possible to allow you to get on with your projects.
Tool Specifics:
The file explorer is broken into two scripts that you need to care about.
- Extensions
- Explorer
Inside Extensions is a method that returns a dictionary of all the defined file types that you want to filter in the File Explorer window. e.g -> Only let users select .png files etc..
I've commented where you can add additional file type filters so customize that to your heart's desire. The layout of how to add more should be pretty obvious but I'll describe it here.
New filter entry -> (key to reference in code, filter heading, file type extension).
I have a Demo folder with a testing script that shows how to use the filters properly. So don't worry about it.
Explorer is a static class that actually handles the icky File Explorer stuff. I have commented all of the methods in here to at least tell you what they do.
But in essence it's as easy as this:
Want to open the file finder?
var filePath = Explorer.SelectSingleFile([filter array]);
and done.
I have some helper methods that convert the file path into a sprite or to read a text file so most of the basic areas are covered.
The demo scene will help you understand anything I explain here poorly.
Sadly there are limitations to this tool...
MUST READ:
This tool targets ONLY Windows applications so if your project was going to be on any other platform then I'm sorry this isn't for you. I will link a github repo with a more expansive File Explorer solution than mine that can tackle that issue.
Another thing, in your player settings you MUST set your Api Compatibility Level to at least .NET 4.x or higher this is because the .dll files that allow me to access the Windows File Explorer require it.
Questions You Will Probably Ask:
Q: Does this work in built projects?
A: Yes, if your project is a windows app. My helper functions will still work on any platform so if you have a file path you want to turn into a sprite or read a text file then you can still use those, however you won't be able to open the File Explorer.
Q: What is that other github repo you mentioned that CAN work on the other platforms?
A: https://github.com/gkngkc/UnityStandaloneFileBrowser
I stand on the shoulders of giants.
Q: Arcturus you just linked me to a way better File Explorer package, why make your own?
A: Uhh because challenge accepted? Also I absolutely refuse to use other people's stuff without at least attempting my own, I have a warrior's spirit dammit! That being said I have linked the forums I used above the methods I needed them for so that you can follow in my footsteps.
Status | Released |
Category | Tool |
Author | ArcturusForge |
Tags | 2D, 3D, Game Design, resource-pack, Unity |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.