Search Unity

Should game objects with unchanged transform position but playing 2D sprite animation be "static"?

Discussion in 'Editor & General Support' started by QuilloGames, Jan 10, 2020.

  1. QuilloGames

    QuilloGames

    Joined:
    Jul 31, 2017
    Posts:
    17
    Hi, I read that setting non-moving game objects "static" can optimize performance. But I am not sure about if the following cases are counted as "static":

    1. Objects with unchanged transform position, but with 2D sprite animation played by an animator controller.

    2. Objects with unchanged transform position, but will be switched between active and inactive during game play.

    3. Objects with unchanged transform position, but certain components will be enabled and disabled during game play.

    4. Objects with unchanged transform position, but will be removed during game play.
    Thanks for any help
     
  2. MetalDonut

    MetalDonut

    Joined:
    Feb 7, 2016
    Posts:
    127
    I believe static refers to the object's position, so if it doesn't move then it's position doesn't need to be recalculated each frame (along with the shadows it creates etc.), although you can play with some of the options there - more info here (https://docs.unity3d.com/Manual/StaticObjects.html).

    You don't move the object in any of your 4 scenarios but you might want to just look into lighting if you're disabling/enabling at runtime. You can easily test all of this though. :)
     
  3. Rekize

    Rekize

    Joined:
    Apr 15, 2017
    Posts:
    5
    Thanks! I will give it a go!