- Home /
Getting Another Object's ID with Colliders
Hello, Is this possible ? I mean, I got a collider only object and i want to get it's name when a object interacts with it.
var IDBox : GameObject;
var name : String;
function ObjectNameController () {
if(IDBox.collider){
name = IDBox.collider.gameObject.name.ToString();
}
}
Something Like This
Answer by Xtro · Sep 03, 2014 at 08:58 PM
Are you aware of collision and/or trigger events ?
Just an example from the documentation : http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html
Or you can get the basic idea from this video : http://unity3d.com/learn/tutorials/modules/beginner/physics/on-collision-enter
For more info, you can email me at onurer gmail com. I can help you in Turkish :)
Actually i want to know when x enters the collider zone of y, string at z's script will take x's name
Your answer
Follow this Question
Related Questions
Make isKinematic false when touching a Collider? 1 Answer
Collider.enabled working differently from inspector? 1 Answer
Rigidbody necessary to use collision detection 0 Answers
How to stop Camera from going into colliders 3 Answers
Detecting if object in array collides with another object in same array 1 Answer