I’m having an issue stopping the thruster audio clip is preventing any audio playing, as in the else condition I can’t specify which clip to stop playing so it’s all audio. So while the space bar is not pressed, audio is constantly being stopped. Therefore any collision noise I have will not play unless I am thrusting.
void ProcessThrust()
{
if (Input.GetKey(KeyCode.Space))
{
// rocketRigidbody.AddForce(Vector3.up);
rocketRigidbody.AddRelativeForce(Vector3.up * thrustPower * Time.deltaTime);
if (!audioSource.isPlaying)
{
audioSource.PlayOneShot(thrusterClip);
}
}
else
{
// audioSource.Stop();
}
}
Commenting out audioSource.Stop()
allows bumps to play while not thrusting but then the whole audio clip for the thrust noise plays until finish.
The only way I can think of fixing this is having the collision script on other objects than the rocket, so audio is played from those objects. Or making an audio handler class of some sort.