Have you ever thought about highlighting often used project folders? This simple but colorful asset allows you to do that!
With Rainbow Folders, you can set a custom icon and background for any folder in Unity project browser.
Just hold the Alt key and click on any of your folders. A configuration dialog will appear, and you’ll be able to assign a custom icon and background for it, your own one or chose from dozens of presets!
Features:
Change icon and background for any folder in the Project window.
Change icon or background for multiple folders at once
Apply custom icon and background for all subfolders automatically
I’m not sure I understand your question, but the general answer is “No” - Unity doesn’t have any API to manipulate with folder icons. This asset uses a tricky workaround and draws custom icons just over default ones.
I meant, can I use your tool in my own Editor Window to change a folder color. So I’d need some sort of API that you might have written to change the color without using the UI (Right click etc…)
If you want to change custom icons from code, you need to look at RainbowFoldersSettings.cs. It’s a typical scriptable object that contains the list of RainbowFolder.cs items, which determine icons for what folders should be overdrawn.
Just to note that I included RainbowFolders in my project and I was able to use it as I wanted inside a custom Editor script that I wrote.
So it is possible to set folder color with RainbowFolders API.
var folderIcons = FolderColorsStorage.Instance.GetIconsByColor(FolderColors.Green);
// Note that relative path must use Forward Slash!
RainbowFoldersSettings.Instance.ChangeFolderIconsByPath(relativePath, folderIcons);
Unfortunately, assets from Editor/Resources folder are NOT stripped from player builds and will be packaged with your game files. In order to avoid this we use the “Editor Default Resources” folders.
The Editor Default Resources folder makes it unusable for us though. The new Unity PostProcessing project also had this problem but they changed stuff and fixed it. I think they’re now just loading the assets by providing the paths. I’m just hoping there is some other way than to use the Editor Default Resources folder.
I just tried to use RF in my current project but I’m also using the new unity collab function. The later works lite github and ad visual tags to folders dpending on their updated status. When using RF it overrides the collab display. I hope this won’t be to much trouble to solve.
Didn’t use unity collaboration functionality yet, definitely need to give it a try. Unfortunately, there is no clean API to draw custom icons in the project browser, so RF just draws custom icons over default ones (and probably collab tags).
Will try to find workaround for this, but no promises about terms. Could you please create the issue on GitHub also?
Good news guys! I got rid of the “Editor Default Resources”. Now you can freely move “Rainbow Folders” wherever you want, just specify its location in Preferences.
You can get the new version from development branch right now, or from asset store a bit later.
I love Rainbow Folders, but the last ALT+CLICK update made it completely unusable to me. In general, a rule when developing assets is to never rely exclusively on keyboard shortcuts, since there might be other assets that eat them. In my case, ProBuilder is eating the ALT key, and thus I have no way to change icons with Rainbow Folders. Please implement a right-click context menu too, I can’t live without Rainbow Folders