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