- Home /
HELP!! OnCollisionEnter is not working when i built it out on IPHONE!
i need urgent help regarding the collision detection problem i had in my game, before i exported the game into my iphone, everything is working file, including the collision detection and stuff, i even tried building it out in other platforms like PC, mac and all is working too, only unity iphone doesnt work. can anyone please tell me whats wrong?
below is my code for the collision part.
//Collision Detection between player and carrots. function OnCollisionEnter( collision : Collision ) {
if(collision.gameObject.tag == "Carrot1" && playerNo == 1 && carrotNo == 1) { Destroy(collision.gameObject); //Destroy Current Gameobject that is being touched. scores.addScore(); scores.addMultiply(); } else if(collision.gameObject.tag == "Carrot1" && playerNo == 2 && carrotNo == 2) { Destroy(collision.gameObject); scores.addScore(); scores.addMultiply(); }
if(collision.gameObject.tag == "Carrot2" && playerNo == 1 && carrotNo2 == 1)
{
Destroy(collision.gameObject);
scores.addScore();
scores.addMultiply();
}
else if(collision.gameObject.tag == "Carrot2" && playerNo == 2 && carrotNo2 == 2)
{
Destroy(collision.gameObject);
scores.addScore();
scores.addMultiply();
}
}
am i doing anything wrong? in the game itself it just doesnt seem to detect the collision.
PLEASE, any suggestion is welcome. )';
Did your project build correctly ? If your project is without the UnityEngine you won't get any "PhysX"
okay, i found the problem that is affecting the whole collision, however the problem is with the GetComponent issues now.
Your answer
Follow this Question
Related Questions
Massive framerate fall with Character Joint 0 Answers
Trying to avoid collision with sides and interiors of polygons 1 Answer
Removing velocity relative to the contact normal 1 Answer
How to Clamp A RigidBody to the Ground/ Moving a RigidBody Along the Ground 0 Answers
Colliding to mesh seams when shouldn't 0 Answers