How to only access one object in array if it's index is 1
Hi all! Never had luck with asking question here so let's see if it's different this time! I have a script that changes the material color of a GameObject. I have multiple meshes and most of them have 3 materials assigned to them. And I just found the code on hoe to access a specific material from them. but the material I want to access isn't in the same spot then on others(basically the material Element on some meshes has index of 1 and on others index of 2). So lets say in array spot that has index 0 I would place the mesh that has the wanted material on Element index of 1. then on array slot that has an index of 1 i put another mash but that one has the Element material on index of 2. Now all I want to do in script is: if the array index is 0, set the correct Element material to specific color. if the array index is 1, set the correct Element material to specific color. I hope its understandable enough. Thanks in advance, -Tilen
Your answer
Follow this Question
Related Questions
How do i remove colored circles on materials? 0 Answers
How do I alter the Emissive colour of a material using C# script at the Start() of runtime? 0 Answers
How do you assign a material to multiple different objects using arrays? 1 Answer
There is no Renderer attached to the MainCharacter game object 0 Answers