How do I add a audioclip to an audiosource?

I have tried this:

var OAudio = Magic.GetComponent(AudioSource); = Resources.Load("Assets/Sounds/WaterMagic");

and It doesn’t add the clip to the AudioSource component how can I fix this?

The path is relative to any Resources folder inside the Assets folder of your project, extensions must be omitted.

So move your audio file to the Assets/Resources/Sounds directory (I’m assuming it’s called “WaterMagic.mp3”), then load it with:

audio.clip = Resources.Load("Sounds/WaterMagic");

When you call “audio” on a component or game object it’s just an AudioSource, so should be replaced with OAudio.clip. Your problem is that you’re not calling Play (even if the AudioSource has “PlayOnAwake” by default, though Awake is called when you call AddComponent, so when you later assign the clip it’s already been called):

var OAudio =;
OAudio.clip = Resources.Load("Assets/Sounds/WaterMagic");

Besides that, make sure you’re using the right path, you’re looking for the folder “Assets/Sounds/WaterMagic” (“Assets” searched by Resource.Load is not the folder “YourUnityProject/Assets”, but “Resources/Assets”).