I’m working on a big project that requires importing large amounts of assets quickly and I’m trying to create a tagging system based on the folder I put each asset in that will be executed by a script which automates other characteristics as well.
For example, if I have a giraffe object whose path is "Assets/Resources/Objects/Animals/giraffe"
, I want to get Animals
as a string. All such tag folders are directly under the Objects
folder.
I’m new to Unity so I could be missing something very simple and I’d appreciate any insight.
You can accomplish what you’re looking for by using some of the methods in the AssetDatabase class, like GetAssetPath
and some string
manipulation methods to extract the tag.
Keep in mind though that these methods are for editor time only , so consider using them as a way to “bake” data into something that your can use in runtime , rather than using them directly during runtime (Like in Awake
or Update
for example)
Use “AssetPostprocessor”
It can help you.
ps.
I don’t recommend you put those files in Resources folder. Because, the assets which are in Resources folder cause app loading delay. The assets which are in Resources folder have been compressed file when you build executive output. When user run your app, it will decompress at the first time. So, I recommend you use the ASSET BUNDLE or ADDRESSABLE.