Use a colider as a trigger?

I have a mesh in my scene that I want to appear only when your player is touching a certain colider. How would I do this? Here’s a script that I have that makes a MeshRenderer equal true when an input is held. I just this edited so that it works when you touch a colider instead of holding a button…

var aimTexture : MeshRenderer;
function Update() {
    if (Input.GetButton("Aim"))
        aimTexture.enabled = true;
    else
        aimTexture.enabled = false;
}

I’ve seen that a lot of the same people have been responding to my threads and I’d like to say thank you. I don’t have anywhere I can take a class, so I’ve been trying to teach myself, and unity threads are my main source. I’ve mostly been reverse engineering scripts to see how they work. Again, thanks for the help!

You should declare a new boolean (e.g “enableMesh”) and use OnTriggerEnter() & OnTriggerExit() to determine whether the player is touching the collider and toggle the “enableMesh” bool.

Set the MeshRenderer.enabled according to the “enableMesh” bool.