- Home /
Question by
Ty1ensen · Sep 12, 2013 at 11:58 PM ·
collisionontriggerenterdeactivate
Can Someone help me with this script?
im trying to get this script to deactivate this gameobject when collided with the cube but if one gameobject is already deactivated to deactivate a differnt gameobject
the script
function OnTriggerEnter(other: Collider){ if (other.tag == "Player"){ GameObject.Find("(1)Green").SetActiveRecursively(false);
if (GameObject.Find("(1)Green") == false){
GameObject.Find("(2)Yellow").SetActiveRecursively(false);
} } }
Comment
I won't answer this because it has already been answered, but in the future you might get more replies if the title is more specific.
Answer by blackcoper · Sep 13, 2013 at 07:26 AM
try using this :
function OnTriggerEnter(other: Collider){
if (other.tag == "Player"){
if (GameObject.Find("(1)Green").active == false){
GameObject.Find("(2)Yellow").SetActive(false);
}else{
GameObject.Find("(1)Green").SetActive(false);
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613114043im_/https://answers.unity.com/themes/thub/images/avi.jpg)