- Home /
Edit asset path/directory before importing
Hey there! I'm working on asset pipeline workflow automation and trying to sort assets into their type's respective folders. I'm using AssetPostprocessors to achieve this.
Currently I'm using AssetDatabase.Move in OnPreprocessTexture to change the path of the asset, however this causes the asset to be imported twice, potentially slowing down the process when importing big files. Also it causes the following warning:
A meta data file (.meta) exists but its asset 'Assets/Art/whatevs.jpg' can't be found. When moving or deleting files outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it.
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Now I'm wondering if there's a way to directly edit the target asset's import path, before doing the actual import, so it only imports once and generates the meta file in the correct location.
Anyone ever encounter a similar problem?
As additional info, this warning is returned when using the 2019.3 Asset Pipeline V2.
When using V1, the error logged is: Asset to move is not in asset database. $$anonymous$$ing me to believe that you can only move assets that are already imported. So the original questions remains: is it possible to change an asset's target path before importing?