Accessing number of drawcalls from script

From Unify Community Wiki
Revision as of 01:27, 6 March 2010 by Gtjuggler (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Javascript - DrawCalls.js

VERY IMPORTANT: The sceneview camera will add to this number!! <javascript>var drawcalls : int = 0; var allObjects : GameObject[];

function Start(){ allObjects = FindObjectsOfType (GameObject); }

function Update(){ for(var obj : GameObject in allObjects){ var rend : Renderer = obj.GetComponent(Renderer); if(rend && rend.isVisible){ drawcalls++; } }

//print drawcalls Debug.Log(drawcalls);

//reset drawcalls every update drawcalls = 0;

//do some math to find average drawcall count here }</javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox