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
- SystemInfo.get_graphicsDeviceName() is generating garbage GC Alloc when using Metal graphics API
- Crash on D3D12CommonShader::ApplyGpuProgram when attaching material which samples "_UnityFBInput0" to "Full Screen Pass Renderer Feature" Component
- SpeedTree meshes and objects count differs when comparing the numbers in the Player with the Editor
- Model and Prefab Preview icons are not updated after upgrading associated Materials to URP
- Game view is rendered white when viewing the Editor with HDR display and Post Proccesing is enabled on the Main Camera with 2D URP
Resolution Note:
PostProcessor callbacks are called during import and importers can't have side effects (i.e. they can't modify other assets)