Reputation: 1
void onCollisionEnter(Collision test)
{
if (xTag.gameObject.tag == "Row 0, Col 0")
{
Debug.Log("X");
}
}
And so my problem is I have two game objects (xTag and yTag) and when they touch the R0C0 game object (which happens to just be a box collider) I want it to print out as a test. The two game objects xTag and yTag, and I have an array that I made and I add to an Array if xTag or yTag touches on R0C0 and so fourth. My problem is that I am now testing and so that if the game object touches the other game object with the tag it prints this. Both xTag and YTag have tags along with the the colliders but nothing is working!
Upvotes: 0
Views: 281
Reputation: 84
You should be checking what test.collider.tag
is. xTag's tag will always be the same. you should check that test.collider.tag == xTag.tag
assuming that onColliderEnter
is on R0C0.
Source: http://docs.unity3d.com/ScriptReference/Collision.html
Upvotes: 1