Search Issue Tracker

By Design

Votes

0

Found in

2021.3.40f1

2022.3.37f1

6000.0.10f1

7000.0.0a1

Issue ID

UUM-75786

Regression

No

AssetPostprocessor is not being called when Parallel Import is enabled

--

-

How to reproduce:
1. Open the “TestPostProcessor.zip“ project
2. Enable the “Parallel Import“ Checkbox in Project Settings > Editor > Asset Pipeline
3. Reimport all Assets
4. Open the AssetGraph window (Window > AssetGraph > Open Graph Editor)
5. Load the “testFlag“ Asset Graph
6. Press “Execute“ on the Toolbar of the AssetGraph window
7. Observe the Console

Expected results: A message reads “flag value True. Should be TRUE”
Actual results: A message reads “flag value False. Should be TRUE”

Reproducible in: 2021.3.40f1, 2022.3.38f1, 6000.0.10f1

Reproduced on: Windows 11 Pro (23H2)
Not reproduced on: No other environment tested

Note: In versions 2022.3.38f1 and 6000.0.10f1, there might be some errors relating to one script of the AssetGraph, deleting it will get rid of the errors and won’t impact the results, and the AssetGraph window will become accessible

  1. Resolution Note:

    Hi!
    The PostProcessor is not meant to be used with Paralell Import because it is not thread safe. It also seems like the PostProcessor is being called. The likely reason why the flag isn't changed is because AssetGraphStaticFlagTest (which calls SetFlag) is called from a different thread, so they don't share the same state.

    Relevant documentation:
    Because parallel imports operate on separate processes, any side effects of your scripted importer code also take effect in that process rather than the main Editor process. Side effects that run on separate processes can cause unexpected problems. For example, if you modify a static variable on a C# class during import on a worker thread, that modification is not automatically visible to code running on the Editor’s main thread.
    Any code that you write for importing should always be self-contained, deterministic, and shouldn’t change the context it’s running in (for example, it shouldn’t change the Editor settings or create new assets on disk). Following these rules helps your importer code avoid parallel threading issues. It also ensures that your import results are always consistent, and that the Editor always uses cached artifacts instead of unnecessarily reimporting your assets.
    source: https://docs.unity3d.com/Manual/ParallelImport.html

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.