Search Issue Tracker

Fixed in 2022.2.X



Found in






Issue ID




Exceptions are thrown when ScriptedImporter generated Prefab is dragged into the Scene view

Scene Management


Tons of Prefab copies are generated into the Scene and exceptions are thrown when the Prefab is dragged into the Scene view

How to reproduce:
1. Open the user's attached "SIOrder" project
2. Open the "SampleScene" Scene
3. Reimport the "SpherePrefab" Prefab in the Project Browser
4. Drag the "DependsOnSphere-c0 Variant" Prefab into the Scene view

Expected result: The Prefab preview is shown in the Scene view, and no Prefab is created in the Hierarchy while the mouse is not released. No error is thrown
Actual result: No Prefab preview is shown in the Scene view, only its name. Tons of copies of the Prefab are created in the Hierarchy until the mouse is released or the Editor gets crashed. Prefab exceptions are thrown

Reproducible with: 2020.3.13f1, 2020.3.26f1, 2021.2.9f1, 2022.1.0b4, 2022.2.0a2
Not reproducible with: 2020.3.0f1, 2020.3.12f1
Couldn't test with: 2019.4.35f1 (errors in user's scripts)

Thrown exceptions:
Prefab instance problem: DependsOnSphere-c0 (Missing Prefab with guid: 9cc0390b2bfcddf409d31244c3ee6371)
Couldn't find matching instance in prefab
NullReferenceException: Object reference not set to an instance of an object

  1. Resolution Note (fix version 2022.2):

    Fixed in 2022.2.0a11

    Crash fix is resolved. For the errors that are seen and to get unblocked, please change line 5 in CustomImporter0.cs
    [ScriptedImporter(0, ".custom-0", importQueueOffset: 1000)]
    [ScriptedImporter(1, ".custom-0", importQueueOffset: 500)]
    The 0 -> 1 is just a version bump, that is needed when changing the code.
    The importQueueOffset is the important part, when set to exactly 500 the prefabs generated from the ScriptedImporter are resolved along with all other prefabs. With this, any problem should not be seen with missing prefabs or variants.
    We are looking at a more clear solution to this, but have nothing concrete to share at the moment.

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.