Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Stuck in an import loop for a prefab asset

Discussion in 'Unity Accelerator' started by renaudbedard, Apr 12, 2021.

  1. renaudbedard

    renaudbedard

    Joined:
    Jul 2, 2012
    Posts:
    20
    We have been using an Accelerator instance in our local network for the past few months, currently running version v1.0.909+g1e7dfa1.
    Our Unity workstations are currently running 2019.4.23f1 LTS.

    Every few months, we have to forcibly evict our cached assets because one or many members of our team has their editor stuck on an import loop on a specific asset. In the latest instance, it's a prefab that gets downloaded from the cache server forever, and never proceeds to load the rest of the project. This is what the editor log looks like, with those lines looping forever :

    Code (CSharp):
    1. RemoteAssetCache - Download - Artifact - success:false, namespace:004e8f7fae1b152205a47a4127c3816c, key:8a6113f47a43126cdba51b131aa480e8 for asset:'Assets/Path/To/Asset/ThePrefab.prefab', time elapsed: 0.026486 seconds
    2. RemoteAssetCache - Download - Metadata - success:true, namespace:7a830f467647736a7d22a8c38d49f282, key:e047971d16363ec51e3c7d9b70a339d5
    3. RemoteAssetCache - Download - Artifact - success:true, namespace:004e8f7fae1b152205a47a4127c3816c, key:7afcc840fa32f2bc2a37e3512ec816f0 for extension:'Assets/Path/To/Asset/ThePrefab.prefab.info', time elapsed: 0.002184 seconds
    4. RemoteAssetCache - Download - Artifact - success:false, namespace:004e8f7fae1b152205a47a4127c3816c, key:8a6113f47a43126cdba51b131aa480e8 for asset:'Assets/Path/To/Asset/ThePrefab.prefab', time elapsed: 0.004031 seconds
    5. RemoteAssetCache - Download - Metadata - success:true, namespace:7a830f467647736a7d22a8c38d49f282, key:e047971d16363ec51e3c7d9b70a339d5
    6. RemoteAssetCache - Download - Artifact - success:true, namespace:004e8f7fae1b152205a47a4127c3816c, key:7afcc840fa32f2bc2a37e3512ec816f0 for extension:'Assets/Path/To/Asset/ThePrefab.prefab.info', time elapsed: 0.002190 seconds
    7. RemoteAssetCache - Download - Artifact - success:false, namespace:004e8f7fae1b152205a47a4127c3816c, key:8a6113f47a43126cdba51b131aa480e8 for asset:'Assets/Path/To/Asset/ThePrefab.prefab', time elapsed: 0.003855 seconds
    8. RemoteAssetCache - Download - Metadata - success:true, namespace:7a830f467647736a7d22a8c38d49f282, key:e047971d16363ec51e3c7d9b70a339d5
    9. RemoteAssetCache - Download - Artifact - success:true, namespace:004e8f7fae1b152205a47a4127c3816c, key:7afcc840fa32f2bc2a37e3512ec816f0 for extension:'Assets/Path/To/Asset/ThePrefab.prefab.info', time elapsed: 0.002513 seconds
    10. RemoteAssetCache - Download - Artifact - success:false, namespace:004e8f7fae1b152205a47a4127c3816c, key:8a6113f47a43126cdba51b131aa480e8 for asset:'Assets/Path/To/Asset/ThePrefab.prefab', time elapsed: 0.004653 seconds
    When this is occurring, the Unity instance is stuck in the "Importing..." step, or shows that it's importing an unrelated asset.

    One thing of note (and I'm not sure how relevant this is), the
    004e8f7fae1b152205a47a4127c3816c
    namespace is a hash I do not recognize. Our namespace hash is the other one,
    7afcc840fa32f2bc2a37e3512ec816f0
    .

    Any info on how to diagnose this further would be very appreciated!
     

    Attached Files:

    mikelortega likes this.
  2. henriksc

    henriksc

    Unity Technologies

    Joined:
    Aug 27, 2020
    Posts:
    30
    This has been reported a couple of times by other customers during the last couple of months, but we still haven't been able to nail down what's happening that causes it to go into infinite loop.

    A couple of questions that might help us in the debugging process:
    1. Is it always the same asset? i.e. "Assets/Path/To/Asset/ThePrefab.prefab"
    2. Is it possible that the prefab asset has cyclic references? So a reference to an object/prefab that references the prefab?
    3.. Can you reliably reproduce it?
    4.. And if so, could you make a small project with the assets that triggers it?.

    The namespaces look fine. Metadata and artifacts are stored in separate namespaces. So from your snippet, it looks ok.
     
  3. renaudbedard

    renaudbedard

    Joined:
    Jul 2, 2012
    Posts:
    20
    Thanks for the response!

    1. No, this happens to several different asset paths. The one thing that's common is that it's always prefabs, and it's always prefab variants that use nested prefabs.
    2. I don't believe so, but is there a way to make sure?
    3. Not really. It happens every few days on a random asset that has been updated, and the problem does not happen on every workstation.
    4. We haven't tried yet,... we'll try when we get a bit of time to spend on this issue!
     
  4. renaudbedard

    renaudbedard

    Joined:
    Jul 2, 2012
    Posts:
    20
    Alternatively, is there a way to disable cache server upload and download for specific asset types? Since prefabs are always causing this issue for us, we'd be happy to disable caching for all prefabs.
     
  5. joe_ftg

    joe_ftg

    Joined:
    Nov 9, 2015
    Posts:
    50
    @henriksc In my experience, this is generally caused by a custom or third party script that, while importing, triggers a reimport. (I'm also using Unity 2019.4.23).

    The most recent example was a script with an OnValidate function which created a new material. The fix was to skip the creation if EditorApplication.isUpdating was true.

    Previously IIRC I've had a script which called EditorUtility.SetDirty inside a custom editor OnEnable.

    Is there a way for Unity to detect import loops and break out, or if that could cause false positives, output some information that would allow tracking down the culprit easier?
     
  6. henriksc

    henriksc

    Unity Technologies

    Joined:
    Aug 27, 2020
    Posts:
    30
    Sadly today it's only possible to disable specific importers if they are scripted importers using attributes https://docs.unity3d.com/2020.1/Doc...AssetImporters.ScriptedImporterAttribute.html. We will be looking into how you can disable native importers.

    We think we've identified the code path where the infinite loop can occur, but we still haven't been able to reproduce it. But yes, we'll try to detect the loop and break out of it. My hope is we will be fixing this soon and do back ports.
     
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I have exactly the same issue, seems it is stuck loading the same prefab for 20 hrs. Is there a way to get around this? Do I need to delete the cache for unity-accelerator?

    edit: killing unity-accelerator.exe allowed me to get past this instantly, thank god.
     
    mikelortega likes this.
  8. SpaceWolfgang

    SpaceWolfgang

    Joined:
    Jan 7, 2020
    Posts:
    1
    @henriksc Did you ever get anywhere with this? We're seeing something quite similar. Joe's suggestion makes sense but we've been unable to track down any suspicious OnValidate/OnEnable calls. I'm not even sure if these would be called when running the build in batch mode.
     
  9. henriksc

    henriksc

    Unity Technologies

    Joined:
    Aug 27, 2020
    Posts:
    30
    This should have been fixed on all released LTS versions. So if you are still experiencing these issues, try to update to the latest minor release.
     
  10. hwnyam_unity892

    hwnyam_unity892

    Joined:
    Jan 28, 2021
    Posts:
    1
    I am using 2019.4.40f1 which is latest LTS version
    and also having same problem.
    In our case, only mac user stuck on import screen while windows os does not.

    help!

    Mac / Windows os both having problem....
     
    Last edited: Sep 5, 2022
    MrDizzle26 likes this.
  11. MrDizzle26

    MrDizzle26

    Joined:
    Feb 8, 2015
    Posts:
    36
    Our whole team is experiencing this issue in 2021.3.14f LTS on both PC and Mac. Certain prefab assets (The same ones every time) get stuck in an import loop. Closing Unity and the Hub fixes the issue, until the next time we switch branches