Huge Lag issues when scaling deep hierarchies

As the title says, I’m getting huge drops in FPS when I scale the root GameObjects in my tree. I have a very big tree (~200 children limit, each with ~200 children). While this operates fine and I’m doing plenty of optimizations to draw less, I’m getting huge lag issues when attempting to scale this tree.

I’ve profiled it extensively and the largest cost is in BehaviourUpdate at 93%, taking 335ms. Within that the top entry is EventSystem.Update() taking 334ms, so somewhere in here is my issue. Within that is CanvasRenderer.OnTransformChanged with 137886 Calls, but only 2.7ms.

|Tree <-- This has a Canvas object on it in worldspace
| - Root <-- Scaling this
    | - 200 children
        | - 200 per child

Each child is a GameObject with like 10 or so GameObject children, only 2 of which use the new UI system.

My framerate drops to like 1 or 2 while scaling the Root object, or all of it’s children.

Things I’ve tried:

  • I’ve tried SetActive(false) on all children when scaling, but that seems to have no impact on the lag. The lag increases exponentially with the number of children. No difference.
  • Toggling enabled and active states of all UI elements in each child. No difference.

My Configuration:

Unity 5
Web Player build
Windows 7 with decent graphics card

My Questions:

  1. Should I be worried about the 137886 Calls even if the time is only 2.7ms?
  2. Does SetActive have no affect on reducing transform calculations, particularly those caused by scaling?
  3. Is uniform scaling really just not possible to do with such complex and large hierarchies?
  4. Anything else I should try?


So I was able to remove the lag only by moving the children outside of the hierarchy, and disabling so they’ve invisible. SetActive apparently has no impact on transformation changes. I’d prefer to keep them visible though, and therefore scale them, so still open to advice!

Possibly you can set camera to position to closest round number. it’s work for me.