Hi, I made a script that will enable an audio when the button is pressed but then audio start playing like maybe on every frame.
here’s my script :
void Update()
{
if (Input.GetKey("i"))
{
engineOn = true;
}
if (Input.GetKey("o"))
{
engineOn = false;
}
if ((engineOn == true) && (!engine.isPlaying))
{
engine.Play();
}
else
{
engine.Stop();
}