Hello everyone,
my use case if very simple: I want the color of an object to change when it is clicked. If the user clicks somewhere else, it gets deselected and the color switches back to the original one.
This already works with a cube for me by the simple code of:
activeObject.GetComponent<Renderer>().material.color = Color.red;
Now I was importing an .obj file to make a prefab out of the mesh. If I click on the imported .obj it consists of a gameobject, a mesh and also a Material. I dragged the import into the scene, added some other components e.g. a meshrenderer and made it a prefab. The prefab also has the script with the line above for color changing. Selecting and deselecting the object works, however the mesh remains white-ish instead of turning red when active.
In the inspector, I assigned a defaul material (instance) to the materials/Element0 of the meshRenderer component component. When I now click on my object, the materialin the inspector also turns red as seen on the little colored sphere displayed. However in game the object still is white.
What am I missing here? Thank you in advance!

