C# Snippet: ColoredMaterialCache reduces memory load
This C# Snippet allows you to create, cache and retrieve instances of materials you need color-variations of. This is great if you want to have the same objects in different colors.
Normally, changing “renderer.material.color” will create an instance of the material for each object you create. If you use ColoredMaterialCache.GetVariationOnMaterial() all materials will be cached and you will end up with one material instance per color instead of one material instance per object.
Get it here as a Gist:






