Sunday, November 1, 2015

unity - Timing a sound effect



Why does this not work? I'm trying to get the sound effect before the visual, but I don't hear it until I move away from the location. This is part of a routine that is called from Update on the Player. Thanks in advance for any hints.


    if (carriedObject.name == "HandTorch") {
float d =findNearest (o.transform);
if (d < 0.5f) {
ASource.clip = woosh;
ASource.Play ();
float duration = woosh.length;
StartCoroutine (WaitForSound (duration));
o.transform.Find("Flame").gameObject.SetActive(true);
o.transform.Find ("MyTorch").gameObject.SetActive (true);

}
}
}

public IEnumerator WaitForSound(float duration)
{
yield return new WaitForSeconds(duration);
}


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...