Search Issue Tracker
By Design
Votes
2
Found in
2017.1.0b8
Issue ID
918669
Regression
No
AssetDatabase.CreateFolder doesn't work properly when called from AssetPostprocessor
When using AssetDatabase.CreateFolder from an AssetPostprocessor callback, the folder is created and although its GUID is immediately accessible, no asset can be moved to this folder because it is not immediately added to the asset database.
In the attached project, the goal of the CustomAssetPostprocessor is to move a "linked" asset whenever a "source" asset is moved.
Bug Reproduction Steps:
1. Import attached project.
2. In Project, delete the "Assets/DestinationFolder/Linked" folder.
3. Manually move the asset at "Assets/OriginFolder/Source/some_texture.pvr" to "Assets/DestinationFolder/Source/some_texture.pvr".
Expected result: File "Assets/OriginFolder/Linked/some_texture.pvr" is moved to the "AssetsDestinationFolder/Linked" folder.
Actual result: The "AssetsDestinationFolder/Linked" folder was successfully created but the "Assets/OriginFolder/Linked/some_texture.pvr" was not moved as a result. In the console, this error appears:
"Parent directory is not in asset database"
Notes:
-If the "Assets/DestinationFolder/Linked" folder is not deleted, the file is transferred succesfully.
-The user has also created the menu "Bug Report/Move Asset", which uses the exact same code the CustomAssetPostprocessor uses to move the "linked" assets but not from an AssetPostprocessor callback. Simply selecting it automatically transfers the files without any errors.
Reproducible with: 5.4.5p3, 5.5.3p4, 5.6.1p2, 2017.1.0b8, 2017.2.0a3
Comments (1)
-
Invertex
Nov 13, 2017 02:25
This issue is still present in 2017.2p1 and is a huge problem for our project. We generate folders quite frequently for material generation/management, so this bug has crippled our modelers' ability to work bring in new assets.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- VFX Graph particles are not culled when using URP and Frustum Culling is enabled on VFX Mesh Output
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
Resolution Note:
PostProcessor callbacks are called during import and importers can't have side effects (i.e. they can't modify other assets)