Hi, I have a problem with a sound, the sound is imported into the project… But when running the game the sound does not play, in the script passes through the line (using the .play() ) of the code but does not sound, why this?
In addition I have a background song, and it plays normally; when I activate the loop option or play on awake in the Audio Source of the sound that doesn’t work: it runs normally
I have the same problem. I have seen a lot of posts about this but no answers. Did u manage to figure it out?
What exactly is the problem, is with the whole sound system, or it is only with a specific sound
My problem probably has to do with the script, as other sounds run correctly
public class BarraVidaPeleador1 : MonoBehaviour
{
public Image barraVida;
public float vida;
public float VIDAMAX;
public GameObject peleador1;
[Header ("La luz del contrario")]
public GameObject luz;
[Header ("Partes y posiciones")]
public GameObject brazoIz;
public Transform posBrazoIz;
public GameObject brazoDer;
public Transform posBrazoDer;
public GameObject piernaIz;
public Transform posPiernaIz;
public GameObject piernaDer;
public Transform posPiernaDer;
public GameObject cabeza;
public Transform posCabeza;
public GameObject cuerpoP1;
public Transform posCuerpoP1;
[Header ("Sonidos")]
public AudioSource sonidoMuerte;
public AudioSource sonidoVictoria;
void Update()
{
barraVida.fillAmount = vida / VIDAMAX;
if(vida <= 0)
{
Sonidos();
luz.SetActive(true);
CreacionMiembros();
Invoke("CambioEscenaMenu", 4f);
Invoke("Desactivacion", 1f);
}
}
private void CambioEscenaMenu()
{
SceneManager.LoadScene("Menu");
luz.SetActive(false);
Invoke("Activacion", 2f);
}
private void Sonidos()
{
sonidoMuerte.Play();
sonidoVictoria.Play();
}
private void Activacion()
{
peleador1.SetActive(true);
}
private void Desactivacion()
{
peleador1.SetActive(false);
}
private void CreacionMiembros()
{
GameObject miembro;
miembro = Instantiate(brazoIz, posBrazoIz.position, posBrazoIz.rotation);
miembro = Instantiate(brazoDer, posBrazoDer.position, posBrazoDer.rotation);
miembro = Instantiate(piernaIz, posPiernaIz.position, posPiernaIz.rotation);
miembro = Instantiate(piernaDer, posPiernaDer.position, posPiernaDer.rotation);
miembro = Instantiate(cabeza, posCabeza.position, posCabeza.rotation);
miembro = Instantiate(cuerpoP1, posCuerpoP1.position, posCuerpoP1.rotation);
}
}
Same issue here. Worked in 2020.2.x, but broke when I updated to 2020.3.0f1… Haven’t touched the script I used in a couple of years…
But what broke? the whole script or the parts of the sounds?
Hello!?
I fixed it every time an enemy died, I created an empty object with the sound, I also put a script that controlled the time, a generous time to sound correctly