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

Scene Management

-

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

  1. Resolution Note:

    PostProcessor callbacks are called during import and importers can't have side effects (i.e. they can't modify other assets)

Comments (1)

  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

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.