Search Unity

Animations slowing down over time

Discussion in 'Scripting' started by Vic070, Jul 24, 2019.

  1. Vic070

    Vic070

    Joined:
    Aug 6, 2016
    Posts:
    9
    I've got 3 (x 4) animations on loop in my idle screen. After some hours go by, the animations start slowing down until it's pretty much 1 frame a second. It happens in editor and on the build project. I'm using Unity 2018.3.9f1 and building for Windows 10. The project is for a showroom in which the app runs all day. The computer turns on in the morning automatically and shuts down the same way in the afternoon, the computer stays on for about 8 hours a day. I don't know if its a memory leak or a bug in the animator (or maybe too many animations playing at the same time). They're all 2D animations done on a canvas UI.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    It's almost certainly some kind of leak, but these things are notoriously tough to track down. Last time I had an issue like this it was because I forgot to call Close() on some video files I was using (third-party video plugin).

    Have you tried running the Profiler to see what is hogging up the processor time? If you can post a screenshot we may be able to help interpret it. (Ideally multiple screenshots, showing the problem as it gets progressively worse)
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,695
    Adding to the good stuff posted by @StarManta above, if you can clearly see memory consumption going steadily up in the profiler, you have a good chance of finding it. First step is to just turn off more and more features in the scene until the leak stops. Now if there's only one feature, well then you need to start turning stuff off in code.

    Use source control (like git) so you can instantly revert any damage you might do.