Search Unity

Question Unity 2022.3.20f1 taking too long after script compilation

Discussion in 'Editor & General Support' started by TheHeftyCoder, Feb 25, 2024.

  1. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    Compiling a script results in waiting for EditorApplication.delayCall:UnityEditor.Sequences.SequenceIndexer.InitializeWithExistingData to end. It takes around 1 min and 30 secs to finish.

    Has anyone else encountered this behavior?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    Look for the 157-reply pinned thread in Editor & General Support

    Or the 652-reply pinned thread in Scripting forum.

    Or any of the other ten million threads posted about this multi-year-old problem.

    Good luck!
     
    TheHeftyCoder likes this.
  3. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    The SequenceIndexer.InitializeWithExistingData seems to run through all the prefabs in the project to build a SequenceAsset database. If there aren't any SequenceAssets, no QuickSequenceAsset.index will be created and thus the process will be repeated each time a recompilation happens. If there are a lot of prefabs in the project, this will massively slow down post-compilation reload time.

    EDIT: It seems even with the QuickSequenceAsset.index existing, the SequenceIndexer.InitializeWithExistingData function still runs. This is mind-boggling.
     
    Kurt-Dekker likes this.
  4. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    A bug has been reported and accepted. The issue is up for anyone to see.
     
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    TheHeftyCoder likes this.
  6. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    Never realized there was already a report. Thanks for this.

    Yes, it is exactly that! I know mostly what's happening because I looked through the code. The SequenceIndexer.InitializeWithExistingData function simply runs through all the project's prefabs after domain reload. It calls .GetComponent for a specific component of that library on every prefab. You can imagine how badly that scales.

    The weird thing is that it shouldn't run that call if a specific file exists, namely QuickSequenceAsset.index.

    It should be a relatively easy issue to fix. Shouldn't take more than an hour to be honest. And it's package related, which means it's an update on the package rather than a new Unity version. However, the problem might be more complex if it arises due to a combination of internal Unity stuff and that package.
     
  7. fahimmanowarj5

    fahimmanowarj5

    Joined:
    Mar 2, 2018
    Posts:
    4
    Out of nowhere today I am facing this problem.
    After any Script Changes, it takes around 2 min for the domain reload to complete.