Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: dreamever99 on October 10, 2015, 05:40:25 AM

Title: 【solved】How to Get Drawcall of UIPanel through Script?
Post by: dreamever99 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.


【solved】
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.
Title: Re: How to Get Drawcall of UIPanel through Script?
Post by: ArenMook 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.