Author Topic: 【solved】How to Get Drawcall of UIPanel through Script?  (Read 1520 times)


  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 5
    • View Profile
【solved】How to Get Drawcall of UIPanel through Script?
« on: October 10, 2015, 05:40:25 AM »
I have tried  UIDrawCall.Count(panel) ,  panel.drawCalls.Count. They all return 0, both in run time and editor mode.
so, can anybody tell me how to get UIPrefab's drawcall through Script?

ps. I know I could use NGUI Drawcall Tool to see the drawcall. But I would like to get all the data through script automatically not just one by one through NGUI DrawcallTool.

Thanks for hints from ArenMook.
I also read source code about UIDrawcallViewer of NGUI.
Select the GameObject in  Hierarchy then the UIDrawcall.Count(Panel) can work.
« Last Edit: October 11, 2015, 11:00:43 PM by dreamever99 »


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to Get Drawcall of UIPanel through Script?
« Reply #1 on: October 10, 2015, 11:43:02 PM »
Prefabs don't have draw calls. Prefabs don't exist in the scene.

Prefab instances is what you see when you drag a prefab into the scene, at which point the actual draw calls get created.

UIDrawCall.Count(panel) will indeed give you the number of active draw calls for that panel. Keyword being "active" -- if a panel is disabled or isn't actually in the scene, this will be 0.