Unity profiler reports that I use 2377 materials / 0.7 MB in scene.
But I have only 200 materials in Entire Project!
![alt text][1]
[1]:/storage/temp/18700-2013-11-29_2037.png
What is that mean?
Can some one explain?
Unity profiler reports that I use 2377 materials / 0.7 MB in scene.
But I have only 200 materials in Entire Project!
![alt text][1]
[1]:/storage/temp/18700-2013-11-29_2037.png
What is that mean?
Can some one explain?
Are you doing anything with the materials in code?
Every time you get a reference to a material it creates a copy.
E.G
void Update()
{ renderer.material.color = Color.red; // Material count will go up by 1 every frame.
}
Instead hold a permanent reference to material as a variable
private Material myMat;
void Start()
{
myMat = renderer.material;
}
void Update()
{ myMat.color = Color.red; // No leaks now
}
Also you may only have 200 materials however when you start the scene are they being shared across objects or do they all have their own instance of a material?
I do not have any code that works with materials.
When i click on material in Renderer Inspector, Unity say that each object references to material that lie in project folder.
But at the same time profiler reports 2000+ materials in use