- Home /
Playing sound file from resources
So I've been trying to figure out how to play a sound clip that I imported into my resources.
how do I link my script
var merSound:AudioFile;
with the actual audio file called "mer"
Comment
Answer by robertbu · Apr 17, 2014 at 08:25 PM
Try this:
#pragma strict
function Update() {
if (Input.GetKeyDown(KeyCode.Space)) {
var ac : AudioClip = Resources.Load("mer") as AudioClip;
AudioSource.PlayClipAtPoint(ac, Vector3.zero);
}
}
Your answer
Follow this Question
Related Questions
5.1 Channels is backwards in unity (non 3D) 0 Answers
Audio Settings Menu 2 Answers
play sound when moving stop sound when not 1 Answer
Why is my backtrack's volume getting lower? 0 Answers
3D Sound Max Distance Not Working. 0 Answers