How would I script a trigger that changes a game objects material to a new material (NOT Texture), when the trigger is entered by that player.

I have no clue how to do this and I’ve looked everywhere.

// player will trigger a material change
void OnTriggerEnter(Collider other) {
if (other.tag == “Player”) {
ChangeMaterial();
}
}

    // creates a new material instance that looks like the old material
    void ChangeMaterial() {
        Material originalMaterial = GetComponent<Renderer>().material;
        originalMaterial = new Material(originalMaterial);
    }

Colliders::

https://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers

http://docs.unity3d.com/ScriptReference/Collider.html

http://docs.unity3d.com/Manual/CollidersOverview.html

Materials:

https://unity3d.com/learn/tutorials/modules/beginner/graphics/materials

http://docs.unity3d.com/ScriptReference/Material.html

http://docs.unity3d.com/Manual/Materials.html