Search Unity

Overhead of animation of inactive objects

Discussion in 'Animation' started by beez-dev, Aug 18, 2021.

  1. beez-dev

    beez-dev

    Joined:
    Aug 13, 2021
    Posts:
    47
    It seems like all the objects with animation in the current scene are played over and over again. But, if I keep the object inactive, would the overhead still persist?
    I'm using Unity's animator to animate. I don't want them to basically not just 'not draw', I want the whole calculation for animation to stop when they come to rest position, and only start again with user event
     
    Last edited: Aug 18, 2021
  2. april_4_short

    april_4_short

    Joined:
    Jul 19, 2021
    Posts:
    489
    Which are you using: Animation Legacy Components or Animator Controller etc?

    Both have ways to cull themselves... with varying degrees of success.
     
  3. beez-dev

    beez-dev

    Joined:
    Aug 13, 2021
    Posts:
    47
    I'm using the animator to animate. By culling do you only mean not drawing in the screen? I don't want them to basically not just 'not draw', I want the whole calculation for animation to stop when they come to rest position, and only start again with user event.
     
  4. april_4_short

    april_4_short

    Joined:
    Jul 19, 2021
    Posts:
    489
    It should be possible. I stopped using Animator Controllers for a lot of reasons. One of them was their always 'animating' overhead, but it's the least of their problems, for me.

    There should be a way to put the state machine open, in its window, whilst running, and play the game until the Animator controlled object is way offscreen and should be culled, and check to see if the state is looping in that Animator state window.

    Good luck with Animator. It's a ... _expletive_
     
    beez-dev likes this.
  5. beez-dev

    beez-dev

    Joined:
    Aug 13, 2021
    Posts:
    47
    I checked out that the animator actually stopped playing when setActive is set to false. But, it that enough to confirm it? I mean, if there was a way to verify it programmatically in the update() function, it would be ideal. Do you know which variable or method lets us query that state(that if an animation is playing)?
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,638
    If you're doing this for performance reasons, use the profiler to see what the difference is with and without Active set
     
    beez-dev likes this.