title: How can I change the color of a material in Unity?
body: <p>I'am developing a Vuforia app that uses Virtual Buttons. I used the example of virtual buttons and I found this part on the script</p>
  
  <pre><code>public void OnButtonPressed(VirtualButtonBehaviour vb)
  {
      Debug.Log("OnButtonPressed");
  
      if (!IsValid())
      {
          return;
      }
  
      // Add the material corresponding to this virtual button
      // to the active material list:
      switch (vb.VirtualButtonName)
      {
          case "red":
              mActiveMaterials.Add(m_TeapotMaterials[0]);
              break;
  
          case "blue":
              mActiveMaterials.Add(m_TeapotMaterials[1]);
              break;
  
          case "yellow":
              mActiveMaterials.Add(m_TeapotMaterials[2]);
              break;
  
          case "green":
              mActiveMaterials.Add(m_TeapotMaterials[3]);
              break;
      }
  
      // Apply the new material:
      if (mActiveMaterials.Count &gt; 0)
          mTeapot.renderer.material = mActiveMaterials[mActiveMaterials.Count - 1];
  }
  </code></pre>
  
  <p>As is seen, I just must add the code at each case to 'do something'. Well, the thing I want to do is to change the color of an object.
  The object is a fbx exported from Maya and has an animation. I want to change the color of a mesh inside the object.
  The object is called "path", inside it has 3 meshes (polySurface1_MeshPart0, ..1, ..2), and each mesh has different materials corresponding to different parts of the mesh, they are materials without texture, just a solid color with shader diffuse.
  I need to change the color of one of these materials in a specific mesh of the object :)</p>
  
  <p>Any help is highly appreciated.</p>