- Home /
Question by
UpheavalEntertainment · Jun 24, 2017 at 12:26 AM ·
gameobjectcollidertriggerother
Get object that triggered an object
hello, very quick how do i access the object with triggered an object with a script like this
void OnTriggerEnter(Collider Tag) { if(Tag.tag == "Building") { Triggered = true; //Get object that made it trigger (other.gameobject or something?)
} }
thanks
Comment
Best Answer
Answer by TonyLi · Jun 24, 2017 at 12:32 AM
void OnTriggerEnter(Collider other) {
if (other.CompareTag("Building")) {
var objectThatMadeItTrigger = other.gameObject;
}
}
Your answer
Follow this Question
Related Questions
Return gameobject from a TriggerEvent. 1 Answer
Reaching a gameobject from its collider 3 Answers
Get All Renderers inside of GameObejct 0 Answers
GameObject going into terrain. 0 Answers