Cant play this sword hit sound in Unity event

i’ve followed this class idk why the sworld hit sound couldnt play
Console sends me this : Can not play a disabled audio source
anyone may knows what’s going on with it ?

Take a look at the AudioSource component on your Weapon prefab. Make sure that it is enabled and that “Play On Awake” checkbox on the AudioSource component is unchecked.

i did the "Play on Awake ", is unchecked still cant play the audio ;/ , my hit and die audio could work idk why couldnt this one

The error message is saying that the component is disabled.


thank you for reply so soon but it seems still not working … :joy: :sob:

Paste in a screenshot of your Weapon component on the Equipped_Sword, preferably with the heirarchy on the sword visible as well. For example:





its not been disabled in prefab or the game mode …just no audio :skull:

This is a bit of a mystery… There’s no obvious reason why it shouldn’t be playing…

Zip up your project and upload it to https://gdev.tv/projectupload

I won’t be able to get to it tonight (It’s 1AM here, and I have business to attend to early in the morning, but I’ll take a look at it when I get home, later tommorrow and see if I can trace out what’s going on.

sorry, i have to use vpn to take the class i cant open this page you sent to me i asked people on gamedev.tv discord and i been told
“If you’re assigning it from the prefab view, it will likely fail, Because the “prefab” is an asset on the disk, not alive in the scene, so it can’t be active and enabled.If you’re assigning from the Scene Hierarchy, we have other issues”
i’m not sure if its my unity version though mine is 2020.3.11 , its just so odd my projectiles has audio but not weapons

It just occurred to me… Are you returning the instantiated weapon in WeaponConfig.Spawn, or the Prefab?
If in doubt, paste in your WeaponConfig.Spawn method



i think this is where i instantiate my weapon and projectile and they both prefabs

By this point, Spawn should be returning a Weapon (WeaponController in your context). This should be stored in Fighter as the current weapon, and this is what should be calling Hit() on.
You may wish to review the previous lecture 23_fp_rpg, Fighter To Weapon Communication.

thank you , i will go back review as soon :+1: