Search Issue Tracker

By Design



Found in







Issue ID




Asset in Editor Default Resources fails to load on startup when using AssetPostprocessor and InitializeOnLoad on said asset

Asset - Database


Reproduction steps:
1. Open the user attached "" project
2. Notice the "Unable to find required resource at flag-nl.png" error in the Console
3. Reimport Assets/Editor/MyPostprocessor.cs and reopen the project
4. Notice that the "Unable to find required resource at flag-nl.png" error does not occur
5. Select Assets/Editor Default Resources/flag-nl.png
6. In the Inspector set "Texture Type" to "Normal map" (trigger the Postprocessor)
7. Apply and reopen the project
8. Observe the Console

Expected result: No errors are logged
Actual result: The "Unable to find required resource at flag-nl.png" error is logged again

Reproducible with: 2020.1.0a1, 2020.3.27f1, 2021.2.10f1, 2022.1.0b6, 2022.2.0a3
Not reproducible with: 2019.3.0a12, 2019.4.35f1

  1. Resolution Note (2022.2.X):

    While this appears to be a regression in behaviour, it actually relates to a deliberate bug fix.

    Previously, postprocessors with a version number of 0 (such as the one in this repro) were ignored when creating the internal hash for postprocessors, which was a bug that was fixed.

    In this case, the [InitializeOnLoad] callback is fired before the custom postprocessor is registered, so the asset is unavailable.

    Previously the asset was available, but because the postprocessor was not registered, it was probably not functioning as expected.

    Because [InitializeOnLoad] is triggered when there is a domain reload, which can happen during an import, it's not guaranteed that all assets will be imported (and therefore loadable) because of dependencies such as these.

    To load the texture when it is known to be imported and loadable, one can use OnPostprocessAllAssets() or EditorApplication.delayCall instead.

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.