Hi every one,
I am trying to spawn the sound cube inside audiocomponent, but the issue the previous sound is overlapping with a new one. So when I pressed P TurnONTheCar() will be running, but in Tick() function where the overlapping is happening, despite spawning the sound. Thank you in advance. here is the code:
void AControllingCar_Cars::Tick(float Delta)
{
Super::Tick(Delta);
if (IsTheCarWorking )
{
if(GetVehicleMovement()->GetForwardSpeed()==0 )
{
PlayingTheSound->Play();
PlayingTheSound->SetSound(CountiniouingEngineSound);
}
}
}
void AControllingCar_Cars::TurnONTheCar()
{
PlayingTheSound->SetSound(StartingEngineSound);
PlayingTheSound->Play();
GetWorld()->GetTimerManager().SetTimer(Timer, this, &AControllingCar_Cars::KeepTheEngineOnTurning,
StartingEngineSound->GetDuration(), false);
}
void AControllingCar_Cars::KeepTheEngineOnTurning()
{
PlayingTheSound = UGameplayStatics::SpawnSound2D(this, StartingEngineSound);
PlayingTheSound->Stop();
EngineBoostingDone = true;
IsTheCarWorking = true;
}