- Home /
How do i make the audio louder?
using UnityEngine;
using System.Collections;
public class CoreHealth : MonoBehaviour {
public int MaxHealth;
public TextMesh CoresGui;
public int health;
public CameraSetter set;
public GameObject particle;
public GameObject Cube;
public GameObject Smoke;
private bool hassmoke = false;
public AudioClip play;
void Awake(){
health = MaxHealth;
}
public void ReceiveDamage(int damage){
health -= damage;
GameObject part = (GameObject)Instantiate (particle, Cube.transform.position, Cube.transform.rotation);
AudioSource.PlayClipAtPoint (play,transform.position,10f); //audio
Destroy (part, 1f);
}
void Update(){
if(set.English == true)
CoresGui.text = "Core Health: " + health + " / " + MaxHealth;
else
CoresGui.text = "Vida do Nucleo: " + health + " / " + MaxHealth;
if (health <= 0)
Application.LoadLevel (2);
if (health == 30 && hassmoke == false) {
Instantiate (Smoke, Cube.transform.position, Cube.transform.rotation);
hassmoke = true;
}
}
}
In this script, when an enemy hits the core, the core loses health, plays and particle and an audio clip. Everything works fine, but the audio is really low. I can't hear it. Can someone please help?
Answer by no9rg · Sep 04, 2014 at 02:31 PM
At the line 22:
AudioSource.PlayClipAtPoint (play,transform.position,10f); //audio
You don't make it any louder by setting the volume above 1f.
One of possible reasons is that all the other sounds play so loud that you can't hear what you want to hear. In that case you need to put them down by some value. But that's only my guessing.
Answer by chanfort · Nov 05, 2017 at 02:54 PM
You can also try to put the sound between the camera and the location of interest, e.g.
AudioSource.PlayClipAtPoint (play, 0.9f*Camera.main.transform.position + 0.1f*transform.position ,10f);
In such case sound would play like it is 10 times closer to the camera.
Answer by TRG96 · Aug 30, 2014 at 04:22 PM
Attach the audio source to the player or the camera and when "health -= damage;" you can play the damage clip that is attached to the camera.
first check to see if the audio file itself is low or not. Then the volume in the editor.
I already checked that the audio source and the clip is in max volume. But still i can't hear much the sound in game
check the distance of the gameobject with the audiosource on it from listener
try changing the sound to 2d sound and not 3d sound. 2d plays the max mo matter what distance is.
if all else fails. the sound is to low, and will need to boost it externally using sound edit software
Your answer
Follow this Question
Related Questions
Play Audio on Collision or Trigger Enter 4 Answers
How can we change default playback device in unity? 2 Answers
Audio Question 2 Answers
Unity 3.5 Beta Audio in SWF issue ! 2 Answers
Walking sound Help 2 Answers