Hey,
So I’ve got a spaceship that flies about with a thruster particle and sound (looped) that both play when the key presses down and stop when I release it. For a while they’ve been working fine but today it seems like really inconsistently either they both wont work on the button press, one wont work and the other will or they’ll both work fine. I’m also getting it so the particle wont turn off after letting go of the button until the next press resets it. I’ve also got some stuff happening when I’m on Input.GetKey as well as the GetKeyDown and GetKeyUp functions. All of the other functionality works fine. The ship moves fine etc as it should, it’s just the sound and particle. And they were working before and from what I can tell should be now and do work fine probably 60% of the time.
This is just on Windows Builds. All is fine in editor.
I know that having lots of sounds in a scene (there’s probably 4 or 5 firing off at certain points) can affect audio playing but my concern lies more with the particle randomly doing whatever it wants!
Code:
if (!gh.inDialogue && !gh.inTutorial) {
if (Input.GetKeyDown(KeyCode.UpArrow))
{
if (hasFuel)
{
thrusterSound.Play();
thrustPS.Play();
}
}
if (Input.GetKey(KeyCode.UpArrow))
{
if (hasFuel)
{
rb.AddRelativeForce(Vector2.up * speed);
gh.fuel--;
gh.FuelBarUpdate();
FuelCheck();
}
else
{
if (notShowingText)
{
gh.noFuelSound.Stop();
gh.noFuelSound.Play();
StartCoroutine("NoFuel");
}
}
}
if (Input.GetKeyUp(KeyCode.UpArrow))
{
thrusterSound.Stop();
thrustPS.Stop();
}
This is in fixed update.
The middle section on GetKey is all consistently work 100% fine. Anyone have any ideas about why a build version would stop consistently turning on and off sounds and particles? Is there a setting for builds I’ve missed?
Thanks in advance!