Author Topic: Huge Framerate-Drop when Menu Shows up  (Read 2587 times)

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Huge Framerate-Drop when Menu Shows up
« on: January 25, 2014, 09:37:24 AM »
Hey there.

(Using latest NGUI Version)

Currently I'm working on optimizing the UI (refering to this topic here: http://www.tasharen.com/forum/index.php?topic=7763.0)
I experienced something else: when the Menu shows up (using HOTween to Tween the Menu down from above), I get for some frames a significant FPS-Drop from 60FPS to around 45FPS, then when the Tween is over (1 sec), it goes to 55FPS and stays at 55FPS
I already tried the NGUI-Tweens, same results.
This only happens on my iPhone 4. Tried same stuff (HOTween and NGUI Tweens) on my iPad mini. That thing doesn't give a damn and stays at 60 FPS.


I recreated the GUI in a whole new blank Project with only NGUI and HOTween imported. Only a blank scene, just the UI. Same results on both devices.

Here are some informations about the Atlas:

- it's a 2048x2048 Texture and holds all Sprites (Buttons, the Font, normal Sprites)
-> the smallest sprite is around 80x81 and the biggest one is 848x631
- Of course I only get two Drawcalls (Main Camera and UI Camera with the NGUI Atlas)

Here's a video in action in the Unity-Editor (don't mind the messy display of Sprites, only for testing purposes):

https://www.dropbox.com/s/xucsxffuc43m3lz/NGUI.mp4

In the Editor it works fine, of course.

Is there something I can do to optimize it on iPhone 4?


Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Huge Framerate-Drop when Menu Shows up
« Reply #1 on: January 25, 2014, 10:14:57 AM »
Are you tweening the widgets or the panel? Try tweening the panel if you're not doing that.

Open up the profiler and try to figure out what's actually causing the slow down.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Huge Framerate-Drop when Menu Shows up
« Reply #2 on: January 25, 2014, 10:22:36 AM »
I don't have Unity Pro, I'm afraid.
And even when I had Pro: how am I supposed to get the slowdown when it only happens on iPhone 4?

I'm tweening the Widgets, yes. But only the Book, which is a UISprite. All the other stuff displayed on the book are children of these UISprite.
To be honest, there are only three panels in the UI:
- UIRoot
- the Questmenu
- the Diarymenu

the two last ones are within the Book.
Should I make a Hierarchy like this:

[...]
- Panel
  - Book
    - other Menus

and then tween the Panel? Would that make such a difference?

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Huge Framerate-Drop when Menu Shows up
« Reply #3 on: January 25, 2014, 10:47:48 AM »
Ha, I tried that now. Made the Book a child of a panel and tweened the panel back down and up.
The result on the iPhone 4:

the FPS do still drop, but from 60FPS to 55FPS and stays between 55-60FPS.

So~~~why is that? Where is the big difference tweening a single Sprite with Sprite/Label-Children and tweening a single Panel with Sprite/Label-Children :D ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Huge Framerate-Drop when Menu Shows up
« Reply #4 on: January 25, 2014, 03:46:16 PM »
Tweening a sprite causes the panel's draw call for that sprite (and all related widgets) to be rebuilt. Tweening a panel does not.