- Home /
Disable Meshrenderer OnTriggerEnter
Hi what i need is a script that disables the Meshrenderer OnTriggerEnter and enable on OnTriggerExit
I tried this but it's not working
function OnTriggerEnter (other : Collider) {
other.MeshRenderer.enabled = false;
}
function OnTriggerExit (other : Collider) {
other.MeshRenderer.enabled = true;
}
Is the other Collider set as trigger? If not the OnTriggerEnter is Never called.
Greetz
no, i have a trigger with this script attached on it
Like in the documentation mentioned, at least one of the objects has to have a rigidbody or OnTriggerEnter is not called, so if you have set one Collider to trigger = true; $$anonymous$$aybe that is the Problem. Did you Debug if the method is definetly called but only not disables the $$anonymous$$eshRenderer?
Your answer
Follow this Question
Related Questions
enable disable object script error? 1 Answer
Problem using trigger to set gameobjects active 1 Answer
How Do i Enable an Object and then Disable it? 1 Answer
enable / disable a script without dynamic typing 2 Answers
Rigidbody velocity limiter 0 Answers