Seem like unity can't detect audiosourse...need help.


I create a script to make the sound play on click(button) I already even put the audio source on the code ro gameobject still…when I hit the button It always said “There is no ‘AudioSource’ attached to the “GameObject” game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object “GameObject”. Or your script needs to check if the component is attached before using it.”

Ty for helping me out.

I’m not quite sure how else to describe this, but there is no ‘AudioSource’ attached to the “GameObject” game object, but a script is trying to access it. You probably need to add a AudioSource to the game object “GameObject”…

Click Add Component → Audio Source.