Search Unity

Question Performance issues with skeletal animation (2D Animation)

Discussion in '2D' started by TenaciousKirikot, Mar 4, 2021.

  1. TenaciousKirikot

    TenaciousKirikot

    Joined:
    Dec 2, 2020
    Posts:
    3
    I recently started working on animation stuff, and I need huge help with performance. The game I'm making will require to have multiple animated objects on screen, so I want to fix low performance.

    Unity version used: 2020.2.6f1
    Animation type: skeletal animation. (Right now I used 3 bones, and maximum amount of bones I'm going to use is about 20)
    Packages used: 2D Animation, 2D IK
    Additional packages installed: Burst, Collections [preview]

    Tests I've made (built the project and then run the executable):
    500 animated objects on screen - 75 FPS
    10,000 animated objects on screen - 10 FPS

    Is there any way to improve this result?
     
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
    Hello @TenaciousKirikot,
    As with any performance issues, the best place to start is to use the profiler to profile your current build and find the bottleneck within your application, and then see how you can improve that particular area.

    For skeletal animations using the 2D Animation toolset, the number of SpriteSkins, the number of bones and the vertices per Sprite would be the main factors to the performance outcome.

    Since your project is dealing with a large number of animated objects, I would also suggest looking into ways to reduce the number of animated objects that needs to be updated/rendered every frame. Clever use of game/level design can give you the performance you aim for, while still making the players believe that the number of objects are always the same.
     
    TenaciousKirikot likes this.
  3. TenaciousKirikot

    TenaciousKirikot

    Joined:
    Dec 2, 2020
    Posts:
    3
    Thanks for the advice! I'll try it!! ;)
     
    Ted_Wikman likes this.