Author Topic: Performance UIPanel in UIDraggablePanel  (Read 13450 times)

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
Performance UIPanel in UIDraggablePanel
« on: June 24, 2013, 08:21:20 PM »
hello. I have a question for performance of my project .
I'm Pro user using 2.6.3
I have a draggable UITable and there are almost 100 object in the table.
and 100 object has own UIPanel

panel(UIPanel),(UIDraggablePanel)
 - table (UITable)
   -PlayerBox (UIPanel)(UIDragContents)
      -label(UILabel) -activeOn
      -icon(UISprite) -activeOff
      -lable_status (UISprite) -activeOn or Off
      -img (UITexture) -activeOff
      -protect (UISprite) -active Off

     -PlayerBox (UIPanel)(UIDragContents)
      -label(UILabel) -activeOn
      -icon(UISprite) -activeOff
      -lable_status (UISprite) -activeOn or Off
      -img (UITexture) -activeOff
      -protect (UISprite) -active Off

  ...100 PlayerBoxes

Panel Clip doesn't work because of UIPanel in UIPanel
so I'm using (OnBecameVisible, OnBecameInvisible) script

(using iPhone 5)
if i do nothing frame rate is 60
but when i start to drag , frame rate change to 20~30

I want to know why my dragpanel performance is bad.
because of object has UIPanel or another reason?

my destination is 200 object move smoothly.
help me please. thank you
« Last Edit: June 24, 2013, 08:30:55 PM by hmnyari »

yuewah

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 180
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #1 on: June 25, 2013, 12:17:46 AM »
how come each PlayerBox need an UIPanel if they are not overlapped ?

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #2 on: June 25, 2013, 08:31:04 AM »
A very good question. It would be much more per-formant if you One panel for all the players together (that panel should have the UIDraggablePanel script that you are probably missing (according to your screenshoot)).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #3 on: June 25, 2013, 09:07:32 AM »
Remove the UIPanel on each playerbox and have the draggablepanel draw it. Select "Cull" on that UIPanel.

It should improve greatly then.

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #4 on: June 25, 2013, 10:24:36 PM »
Remove the UIPanel on each playerbox and have the draggablepanel draw it. Select "Cull" on that UIPanel.

It should improve greatly then.
thank you but I have problem if playerbox has no UIPanel.

Would you please see this video?

http://www.youtube.com/watch?v=pbsubaS4t7k

this is my problem between playerbox has UIPanel and don't have UIPanel

I can handle UISprite'depth using z-depth(UIPanel) and z-Position(Transform) but dynamic font is not working.

I want to do second behavior without UIPanel

Is there any solution?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #5 on: June 26, 2013, 10:50:55 AM »
OK, I see what you're trying to do.

I would do it like this:

Remove the default UIPanel on the player box.

When you change the playerbox state to be draggable, add a UIPanel to the playerbox or spawn a secondary playerbox instead and have this one have it's UIPanel as you do now. When you release it, you can remove that UIpanel again.


Does that help?

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #6 on: June 30, 2013, 02:26:22 AM »
OK, I see what you're trying to do.

I would do it like this:

Remove the default UIPanel on the player box.

When you change the playerbox state to be draggable, add a UIPanel to the playerbox or spawn a secondary playerbox instead and have this one have it's UIPanel as you do now. When you release it, you can remove that UIpanel again.


Does that help?

Thank you for answer me

but performance is not changed.

when I start drag , frame down to 20~30

when stop dragging ,frame up to 60 

I think problem is not UIPanel

maybe problem is dragpanel script series

I recorded profiler but I don't understand this result means;;

watch this at 1080p please

http://www.youtube.com/watch?v=CmOqQeWo1BM

thank you :)
« Last Edit: June 30, 2013, 03:13:32 AM by hmnyari »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #7 on: June 30, 2013, 05:01:48 PM »
As far as I can see, it seems to be a side-effect of dragging. If you notice, the majority of CPU time is used on UpdateGeometry(), which suggest to me that the playerbox you're dragging around is still being drawn by the "big" UIPanel with the draggablepanel on, which means the whole thing needs UpdateGeometry every update. Look into the Drag&Drop example that comes with NGUi on how to properly change the UIPanel run-time. I'm certain getting this done right will improve performance.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #8 on: June 30, 2013, 05:04:33 PM »
Also, the GC seems to spike crazy when you're dragging, that suggests to me that you're ot using the newest version which has massive performance improvements with just this problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #9 on: June 30, 2013, 10:05:14 PM »
Looking at the original video, you seem to have "New" text fading in and out on every single label.

Doing this causes the entire buffer to rebuild every single frame.

You need to stop doing this if you care about performance. Changing things every frame is VERY BAD for performance.

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Performance UIPanel in UIDraggablePanel
« Reply #10 on: July 01, 2013, 01:46:16 AM »
thank you Nicki , ArenMook

Looking at the original video, you seem to have "New" text fading in and out on every single label.

Doing this causes the entire buffer to rebuild every single frame.

You need to stop doing this if you care about performance. Changing things every frame is VERY BAD for performance.

maybe New is not problem. Even if  I delete New label result is same .

I tested NGUI example (scroll) using 100 object

test was really fast. always 60fps

I think problem is my scene (but I don't know what is problem..)

When I figure out the reason I will notify you

thank you spend time for me  :)