- Home /
Question by
huimc · Aug 04, 2013 at 04:29 PM ·
collisiontriggerrenderer.enabled
Making objects visible when nothings collide with it
I use these codes to make "ArrowObj" become visible when another game object collide with "HelpStartBox", it works:
public var ArrowObj:GameObject;
function Start () {
ArrowObj.renderer.enabled = false;
}
function OnTriggerEnter(col:Collider) {
if(col.gameObject.name=="HelpStartBox"){
ArrowObj.renderer.enabled = true;
yield WaitForSeconds(2);
Application.LoadLevel (1);
Debug.Log("1");
}
}
But when I want to make "ArrowObj" become invisible when nothings collide with "HelpStartBox", I don't know what to do. I have tried to put these codes but it didn't work.
else {
ArrowObj.renderer.enabled = false;
}
What should I do?
Comment
Best Answer
Answer by voporak5 · Aug 04, 2013 at 05:04 PM
do function OnTriggerExit() and put ArrowObj.renderer.enabled = false; that bad boy in there
Your answer
![](https://koobas.hobune.stream/wayback/20220613111525im_/https://answers.unity.com/themes/thub/images/avi.jpg)