- Home /
The same audio plays differently on a variety of buttons, how can I change this?
Hey,
I have a couple of buttons (New Game, Settings, Credits etc.). Each of these buttons have a GameObject attached to them (under On Click) in which I have a code to play audio. Now, the audio which plays on the New Game button is very loud and almost sounds like there are many instances of that audio playing at the same time. Here where it is getting weird: That same audio plays on the Settings and Credits buttons and it sounds just like it was meant to, without any problems.
How come the audio sounds differently? I didn't change any AudioSource settings and even if I did, it would change for all the buttons. I have checked the individual buttons whether I accidentally attached an additional AudioSource but I haven't, I am not sure what to do.
Here is the code used to play the audio if anyone is interested:
using UnityEngine;
using System.Collections;
public class ButtonAudio : MonoBehaviour {
public AudioClip Sound_Button;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void buttonsound (int buttonsound){
GetComponent<AudioSource>().PlayOneShot(Sound_Button);
}
}
Screenshots:
GameObject
New Game Button
I would also show the settings button but max of 2 attachments and it looks literally the same like all the other buttons. Only the New Game button is playing up.
Thanks!
Your answer
Follow this Question
Related Questions
Play sound on button click before loading level. 3 Answers
How to control an AudioSource with an AudioClip? 2 Answers
Play Sound when GUI button is pressed. 7 Answers
play an audio clip from a GUI button 1 Answer
How to instantly play an AudioSource 0 Answers