- Home /
Should game objects with unchanged transform position but playing 2D sprite animation be "static"?,About setting non-moving game objects to static, does 2D sprite animation count as moving?
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":
Objects with unchanged transform position, but with 2D sprite animation played by an animator controller.
Objects with unchanged transform position, but will be switched between active and inactive during game play.
Objects with unchanged transform position, but certain components will be enabled and disabled during game play.
Objects with unchanged transform position, but will be removed during game play.
Thanks for any help
Answer by ashishcw · Jan 10, 2020 at 09:39 AM
As far as my opinion, the static functions can be set to the objects, which as available in the game/scene, however they do not mean to move/change their transforms, meaning, these objects are precomputed in the engine, which adds huge performance boost.
In your case, as you pointed it out correctly, since you won't be moving the objects anywhere, it's a good idea to set them to static.
For example, in one of my projects, I had trees as an objects which needed to animate(Sort of a wind effect), setting all of them to static(also known as static batching, and performing animator on it, did the job, without compromising much on the performance. https://answers.unity.com/questions/593206/how-static-batching-works.html
Answer by RemDust · Jan 16, 2020 at 02:24 PM
In this context, "moving" has nothing to do with "animating".
Static, dynamic and sleeping are physics (rigidbody) related, which sprite is actually displayed has nothing to do with your rigidbody state. :)
Thank you for the explanation. Does that mean if there is no rigidbody component in the object, it doesn't matter if it is set to static?
static is actually a Rigidbody property ! You can't set it if you don't have the rigidbody component on your gameobject ;)
Your answer
Follow this Question
Related Questions
Saving an object from script to project? 0 Answers
Log game object's actions 0 Answers
if game object is located at... 1 Answer
Help with GameObject.FindGameObjectsWithTag 1 Answer
Sprite Not Showing after build to .apk Unity 5.4 ?? 1 Answer