HI,
Can any one please help me? When i start my game the player only some times goes under the platform and others the platform will stop the player from moving across it.
void Start () {
playerCollider = GameObject.Find (“player”).GetComponent ();
Physics2D.IgnoreCollision (platformCollider, platformTrigger, true);
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.name == "player")
{
Physics2D.IgnoreCollision (platformCollider, playerCollider, true);
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.gameObject.name == "player")
{
Physics2D.IgnoreCollision (platformCollider, playerCollider, false);
}
}