Audio script not working
I have an audio script to play a little blinking sound when a collectable is picked up. So far I have not managed to get ANY of my audio scripts to play unless the source is set to play on awake. I have the listener on my 3rd person camera, I have the Audio Source attached to the collectable, and I have the assigned sound properly put in. I followed everything off the unity video tutorial but just cant get anything to work. Ive been at this on and off for days. Help would be very appreciated!!
using UnityEngine; using System.Collections;
public class BingSound : MonoBehaviour {
public AudioClip boing;
private AudioSource source;
// Use this for initialization
void Awake ()
{
source = GetComponent<AudioSource> ();
}
void OnCollisionEnter (Collision coll)
{
source.PlayOneShot (boing, 1F);
}
}
Yes it is. All other collision based functions I have are working.
Are you sure there is not any error thrown by the console ?
Are you sure you have assigned the AudiClip ?
Are you sure your gameobject has the AudioSource component ?
Are you sure the collision is correctly detected by the object holding the
BingSound
script ?
Your answer
Follow this Question
Related Questions
Pick Up Sound 0 Answers
I want the audio to play when the player nears the object, but fade away when they walk away. 0 Answers
Stop AudioSource on Trigger!!! 1 Answer
How to solve Audio Mixer related problem? 0 Answers
Audio Cutting Out Unexplainably 1 Answer