diff --git a/RuntimeAudioImporter/Source/RuntimeAudioImporter/Private/RuntimeAudioImporterLibrary.cpp b/RuntimeAudioImporter/Source/RuntimeAudioImporter/Private/RuntimeAudioImporterLibrary.cpp index 021b679..f33be6a 100644 --- a/RuntimeAudioImporter/Source/RuntimeAudioImporter/Private/RuntimeAudioImporterLibrary.cpp +++ b/RuntimeAudioImporter/Source/RuntimeAudioImporter/Private/RuntimeAudioImporterLibrary.cpp @@ -39,17 +39,15 @@ bool URuntimeAudioImporterLibrary::DestroySoundWave(USoundWave* ReadySoundWave) //Delete all audio data from physical memory ReadySoundWave->RawData.RemoveBulkData(); ReadySoundWave->RemoveAudioResource(); + AsyncTask(ENamedThreads::AudioThread, [=]() { ReadySoundWave->InvalidateCompressedData(true); + }); //Finish USoundWave destroy (complete object deletion as UObject) - if (ReadySoundWave->IsReadyForFinishDestroy()) { - ReadySoundWave->ConditionalFinishDestroy(); - ReadySoundWave->FinishDestroy(); - return true; - } - else { - return false; - } + ReadySoundWave->IsReadyForFinishDestroy(); //This is not needed for verification, but for the initial removal + ReadySoundWave->ConditionalFinishDestroy(); + ReadySoundWave->FinishDestroy(); + return true; } else { return false;