0

I have just published a 2D ball game using Unity 2019.3.9f1 in google play and I downloaded it on my phone. When I played it, the sound of the ball hitting the wall seemed to to be delayed by a half second. But it works completely fine when I tested it on my computer. Is there anything I may be missing or done wrong? How can I fix this problem? Any help is appreciated! Here is script ---

 private void OnCollisionEnter2D(Collision2D collision)
{

    if (collision.otherCollider.ToString() == "Racket (UnityEngine.BoxCollider2D)")
    {
        if (Ball.activeSelf)
        {
            Ball.GetComponent<AudioSource>().Play();
        }


    }

}
Jelly Qwerty
  • 317
  • 1
  • 4
  • 13
  • I doubt that this is the cause but...can you try to check instead of string name, give it a Tag name, and compare with tags? (should be faster). – Lotan May 27 '20 at 09:25
  • I am afraid I cannot because the racket has two different kinds of collider. Any other ideas? – Jelly Qwerty May 27 '20 at 09:54
  • If your racket has two different colliders it means that every collider is in a separate object, cause Unity do not allow to have different colliders on the same GameObject, so you can assign differernt tag for the parent collider and the child one, no? – Lotan May 27 '20 at 09:55

0 Answers0