Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Asset Reference Resolving by labels. Add including only ignored tags/labels. Update AssetRefResolver custom editor. #3

Merged
merged 3 commits into from
Dec 14, 2024

Conversation

fitbie
Copy link
Contributor

@fitbie fitbie commented Dec 14, 2024

Currently AssetReferenceResolver use "Ignore by GO tag" logic. It works fine for prefab assets, but there are thousands of non-GO assets, which may need to be ignored. Unity has powerful feature for filtering assets - labels, which can be assigned in the bottom section of asset inspector. So i added ignoredLabels string[] field and implemented filtering logic.

Also, in some cases user may want to include only assets with certain tag/label, instead of ignoring those labels/tags. For this case i added 2 fields includeIgnoredTags/Labels

I tested it for my project, works fine. Of course there will be extra CPU/Memory extra utilization (about 15%), but only when user adds any values to ignoredLabels. IncludeIgnored works via simple XOR and boolean ops.

I'm also suggesting to remove "Tags" logic for reference resolving, and maybe add labels to PrefabReferenceResolver, because labels are the perfect way for asset filtering during EditorTime (where reference resolving is actually happening), also, unlike tags, we can apply any amount of labels to the asset/prefab. But this suggestions are completely under your command, just let me know if you accept it.

@hasanbayatme
Copy link
Member

That's awesome, thank you!

Yes, I totally agree with switching over to labels and it makes much more sense, because some other interesting features can be implemented through that, like specifying how a Texture should be serialized from its Label such as png, jpg and so on.

I wonder why I haven't gone that route instead.

@hasanbayatme hasanbayatme merged commit 3395b6f into BayatGames:main Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants