Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Animation Preview very laggy and stutters when inside an addressable group

Discussion in 'Addressables' started by CodeBombQuinn, Jan 11, 2022.

  1. CodeBombQuinn

    CodeBombQuinn

    Joined:
    Apr 17, 2018
    Posts:
    23
    Steps to reproduce:
    1. In my case I have a folder marked as addressable.
    2. Inside the folder is only animations (or FBX files containing animation clips as well)
    3. Click on an FBX to preview the animation, the preview window in unity shows the animation clip itself is not marked addressable, but does show that it's a subasset under the folder with a greyed out addressable path.
    4. Click the "Play" button in the preview window to watch the animation
    Result: Animation playback is extremely laggy and choppy. Even the Editor profiler slows to a crawl, like maybe 2 fps.

    5. Now pause the animation preview
    6. Click the Addressable checkbox to make that FBX/animation into an addressable asset
    7. Click "Play" button again in preview window​

    Result: Animation playback is smooth as butter. Editor profiler showing 60fps.

    Expected Result: Animation playback should always be smooth no matter if item is addressable or not.

    While profiling I noticed that when Addressables is OFF on the item, there's a LOT of garbage collection happening. roughly 5.5MBs per frame. Turning ON the item, all of that GC is gone.


    This is the only other reference I could find to this issue: https://issuetracker.unity3d.com/is...n-using-a-lot-of-keyframes-to-edit-animations

    @MrCool92 posts a way to fix it. Here's his summary of this issue:

    "For anyone that uses addressables - we managed to fix this for us.

    When using preview window an inspector header is redrawn and addressable entry deep check is performed. This causes GC."​

    He has some other code I won't post here. But essentially he caches a HashSet of tried paths to ensure it's not checking every frame.
     
  2. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    26
    Did you try the latest version (1.19.17)? Looks like they fixed it. I don't get any lag anymore.
     
  3. CodeBombQuinn

    CodeBombQuinn

    Joined:
    Apr 17, 2018
    Posts:
    23
    That's great! I should've mentioned this originally, we're still on Unity 2019.3.10f1. Which I think Addressables 1.19+ requires 2019.4+. We're hoping to upgrade soon so maybe this will fix it.

    Thanks!