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
-
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
- Only the left screen is rendering when using Render Graph Fullscreen Blit in Meta Quest 2
- Context menu with the "Revert" option doesn't appear when pressing the right mouse button on a "Vector2" or "Vector3" property in the Inspector of a custom shader
- Missing Render Feature "Full Screen Pass Render Feature" in any “Universal Renderer Data” asset when upgrading from 2022.3
- Inconsistent ParticleSystemVertexStream.PercentageAlongTrail data range in Trail Texture Modes except "Stretch"
- The Graph Debug Window can be right clicked through and the Node Workspace is manipulated instead
Resolution Note:
PostProcessor callbacks are called during import and importers can't have side effects (i.e. they can't modify other assets)