Material Change Color on trigger.

Hello, so I have very little experience in programming. I mostly do 3D modeling. Basically I want the material to change colors when my player enters a trigger. I have a computer that I want to be dim unless the character is by the computer. Right now the computer always has the bright material. 123798-computer.png

@tommyleenev

Something like this should work. I recommend checking the Unity documentation for questions like this. If you look under material or Renderer I am pretty sure you can find some great information. Otherwise here is a script that should work:

public Material brightMaterial;
public Material dimMaterial;

void OnTriggerEnter(Collider col) {
    if (col.gameObject.tag == “Player”) {
        transform.GetComponent<Renderer>().material = brightMaterial;
    }

}

void OnTriggerExit(Collider col) {
    if (col.gameObject.tag == “Player”) {
        transform.GetComponent<Renderer>().material = dimMaterial;
    }

}