Reputation: 65996
So I did (in Unity editor):
GameObject -> Create Empty
the I dragged my Avatar.cs (the main player animation MonoBehaviour
) onto the gamefile.
Inside Avatar.cs I added:
public AudioClip audioClipJump;
and
// this is where the jump animation gets played
audio.PlayOneShot(audioClipJump);
Back in Unity editor, I see the component Audio Clip Jump
inside GameObject.Avatar, and I drag and dropped the .wav file onto it.
Then I go into the game, and the jump animation plays, but I have no sound :(
here is a screenshot of the Unity editor:
and like I said, just the 2 lines in the C# file
Upvotes: 2
Views: 14984
Reputation: 5434
Upvotes: 2