favoyang / unity-addressable-importer

A rule based addressable asset importer
MIT License
885 stars 124 forks source link

"Select Assets" button for rules #25

Closed eAi closed 3 years ago

eAi commented 4 years ago

It'd be really useful if the rules had a "Select Assets" option that ran the rule against the entire asset database and selected assets that matched that rule. This would improve the workflow of trying to work out what the correct regular expression should be to match a folder.

I tried implementing this, but I couldn't see a way to do this sensibly that fitted with the existing pattern of implementing very generic attributes (like ButtonMethod). If a fully implemented Editor was created for the settings, this would be quite straightforward but that doesn't really fit the existing pattern.

It'd also be nice to have the reverse - select an asset/folder in the project view and create a rule for it.

favoyang commented 4 years ago

Hi @eAi,

Again, thanks for sharing this.

My first guess is whether Unity supports to customize the context menu of an array row. But seems not.

Then maybe try PropertyDrawer, to give a custom look of the AddressableImportRule object, to add an UIElement button for a row. Beware of some existing features like ConditionalField.

One thing to notice is that a rule can apply to entries of multiple folders, I'm not sure to select them all at once is the best choice to preview a regular expression, because you can only see one folder in the project view at a time. Or maybe simply a dry-run button to print all rules and their matched assets to console, or a big popup window is just enough?

The reverse can be implemented as a popup to suggest whatever rules it maybe.

The last choice will be a fully re-implemented importer window with whatever feature you want. But that probably won't happen until the next big 1.x.x release, considering the complexity and UX design.