MaterialAnalyzer

Author: Xadhoom

Description
Adds a new editor window at menu Custom→MaterialAnalyzer. The editor window allows analyzing and list all materials used by the current selection in scene. Results can be dumped as material list or hierarchy to text files. This window helps to keep track of material usage to optimize drawcalls.

Background information can be found here: http://trianglestrip.blogspot.de/2012/07/material-analyzer.html

Usage
You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

Click on Custom→MaterialAnalyzer

Select one or more game objects in scene. Press Analyze Selection. Now the list should show all materials used by the selected game objects. The small button to the left in the list select the material asset. Selecting one or more list items selects the game objects using this/these materials.

Press Dump Hierarchy to dump the selection hierarchy including the used materials to text file. Press Dump List to dump the list of materials to text file including the game objects using each material.