Hello, I have a group of gameObjects (cubes) and I have script for this group (not for every cube). And I need save material of every item in this group to the variable. But I dont know how.
Please can you help me?
Thank you very much
Are you trying to get the instance of material?
If so use this: renderer.material
yes, but if I tryed this:
I get this error:
Problem is, I use script at group of objects. Not for every under group object
Use Resources.Load() to load and apply material to an Object!
private Material simpleMat;
void Start()
{
simpleMat = this.renderer.material;
}