Hi there!
When i was adding more buildings, I had the problem that for some buildings, the wrong material was colored. To identify which material should be set to the team colors, i added
to TeamColorSetter.cs and dragged the Material “BuildingWhite” in on the buildings prefab. Also I updated HandleTeamColorUpdated and added a foreach loop to compare the current renderer’s materials against the new input. For the comparision I have to use renderer.sharedMaterial, as renderer.material is instantiated and will therefore always return false when compared with teamColorMaterial. SetColor on the other hand should not be applied to the sharedMaterial, but to the current material instance instead. My question is: How do i get the current material’s respective sharedMaterial / is there a more elegant way to achieve selective recoloring of defined material(s)?
This is working, but updates the shared material - not what I want to achieve: