Help me please i searched my problem but nothing can fix.
In this case i made a PlayerBall, used a Circle Collider2D with a rigidbody2d and one children for checking other collider, it seems to work but when my collider checker enter other.collider it is working when the ball is slow, but when it is fast, going down from the top in other.collider and hit it, its not working some times.
I think it is not in my code but in the collider some times it hits but some times its not.
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "CheckUp")
{
UpOrDown = true;
scorenila = ballValueUp;
} else if(other.gameObject.tag == "CheckDown")
{
UpOrDown = false;
scorenila = ballValueDown;
}
if (other.gameObject.tag == "UpRing")
{
if (UpOrDown == true)
{
Destroy(other.transform.parent.gameObject);
score += scorenila;
ScorUpSound.Play();
print("Spawn Ring Because UpRing is not in the game");
StartCoroutine(controller.SpawnWaves(3, 0.3f));
Destroy(GameObject.FindWithTag("Ring"), 0.1f);
Instantiate(deathObj, GameObject.FindWithTag("Ring").transform.position, GameObject.FindWithTag("Ring").transform.rotation);
UpdateScore();
}
}
else if (other.gameObject.tag == "DownRing")
{
if (UpOrDown == false)
{
Destroy(other.transform.parent.gameObject);
score += scorenila;
ScorDownSound.Play();
StartCoroutine(controller.SpawnWaves(3, 0.3f));
Destroy(GameObject.FindWithTag("Ring"), 0.1f);
Instantiate(deathObj, GameObject.FindWithTag("Ring").transform.position, GameObject.FindWithTag("Ring").transform.rotation);
UpdateScore();
}
}
}
PS Sorry for bad english: I only add a rigidbody2d in my player ball.