Hi,
in my project I want a sound to play and then for an objects active state to be set to false, at the moment both are happening at the same time so the sound doesn’t play. If I keep the active state as true then I will hear the sound play.
How can I make sure that the audio finishes before the set active state is switched to false, any help or advice is appreciated.
Here’s a selection of my code;
void OnTriggerEnter(Collider other)
{
if (other.tag == "Pick Up")
{
if (!isPlayed) {
source.Play ();
isPlayed = true;
}
}
if (other.gameObject.CompareTag ("Pick Up"))
{
other.gameObject.SetActive (true);
count = count + 1;
SetCountText ();
}
}