When I use the offical export function to post event, Callback worked. But, if I directly NewObject<UAkComponent> and call AkComponent->PostAkEventByNameWithDelegate(EventName, AkCallbackType::AK_EndOfEvent, OnEventCallBack). callback function will not be called and the uUserFlags always be 0 nomatter what the mask I used.
code like :
UAkComponent* AkComponent = NewObject<UAkComponent>();
if (AkComponent)
{
FString EventName = EventID.ToString();
FAkAudioDevice* AudioDevice = FAkAudioDevice::Get();
if (AudioDevice) {
AkComponent->RegisterComponentWithWorld(UGameInstance::Get()->GetWorld());
AkComponent->SetWorldLocationAndRotation((Position), FRotator::FRotator().Quaternion());
AkComponent->SetAutoDestroy(false);
AkComponent->OcclusionRefreshInterval = 0;
{
FOnAkPostEventCallback OnEventCallBack;
OnEventCallBack.BindDynamic(this, &UAuidoInstanceMgr::OnPostEventCallback);
//AkPlayingId = AudioDevice->PostEvent(EventName, AkComponent, OnEventCallBack, AkCallbackType::AK_EndOfEvent);
AkPlayingId = AkComponent->PostAkEventByNameWithDelegate(EventName, AkCallbackType::AK_EndOfEvent, OnEventCallBack);
}
}
}
and. at the wise code:
FAkComponentCallbackManager::AkComponentCallback
the pPackage->uUserFlags always be 0.
-/-