PlayClipAtPoint randomly fails to sound

Hello,
Im testing PlayClipAtPoint function and it works sometimes and others it doesn’t.

AudioSource.PlayClipAtPoint(Click, Camera.main.transform.position, 1.0f);

If instead I use an audio source component it always works.

Is there any known issue/bug?

Thanks :wink:

As far as I am aware, it tries to create an audio source at that point and if it has problems doing that it fails.

In general, using a static function like that isnt the best, you are always better off supplying a specific audio source so you get some granular control over what is happening. Its also terrible for memory.

I cant think of any use case where you would not want to do that, even if you just want to ‘fire and forget’ you should still write some sort of audiosource manager first so you can always get a free audiosource to supply it with, and get decent error feedback if one is not available.

I wanted to do a sound manager with scriptable objects so I wouldn’t need to pass it through all my scenes, but if I need an audiosource component, it seems I will need a GameObject for all my scenes :(.