- Home /
Question by
isse26 · Jan 20, 2014 at 04:06 PM ·
getcomponentontriggerenter
Check OnTrigger for component
Hi I need to check my OnTriggerEnter thing if it contains the script "PhysicsGround.cs" and then take the gamobject that I collided with and assign it to a varieble.
Please help and excuse my bad english.
Comment
Answer by robertbu · Jan 20, 2014 at 04:09 PM
function OnTriggerEnter(other : Collider) {
var pg = other.GetComponent(PhysicsGround);
if (pg != null) {
// Do whatever when there is a PhysicsGround component
// 'other.gameObject' will be the game object to save
}
}
Your answer
Follow this Question
Related Questions
Is there a way to find other's components using OnTriggerEnter? 1 Answer
C# - Problem with trigger that won't activate 1 Answer
How can I increase Health Value on trigger enter, to another game object? 3 Answers
getComponent not working with Triggers? 1 Answer
Collection Using "GetComponent" 1 Answer