【UE4 C++】播放声音、特效
播放声音
-
PlaySoundAtLocation()USoundCue* HitSound = LoadObject<USoundCue>(this, TEXT("SoundCue'/Game/Demo_Drone/Sound/explore_Cue.explore_Cue'")); if (HitSound) { UGameplayStatics::PlaySoundAtLocation(this, HitSound,SweepResult.Location); } -
PlaySound2D()UGameplayStatics::PlaySound2D(GetWorld(), HitSound) -
其他
SpawnSound2D()返回 UAudioComponent*CreateSound2D()返回 UAudioComponent*SpawnSoundAtLocation()返回 UAudioComponent*SpawnSoundAttached()返回 UAudioComponent*
播放特效
-
SpawnEmitterAtLocation()返回 UParticleSystemComponent*FString exploreParticlePath = TEXT("ParticleSystem'/Game/InfinityBladeEffects/Effects/FX_Monsters/FX_Monster_Chicken/P_Proj_Chicken_Imp_Explo_01.P_Proj_Chicken_Imp_Explo_01'"); UParticleSystem* exploreFX = LoadObject<UParticleSystem>(this, *exploreParticlePath); if (exploreFX) { UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), exploreFX, FTransform(UKismetMathLibrary::MakeRotFromX(SweepResult.Normal), SweepResult.Location, FVector::OneVector)); } -
SpawnEmitterAttached()返回 UParticleSystemComponent*
作者:砥才人
出处:https://www.cnblogs.com/shiroe
本系列文章为笔者整理原创,只发表在博客园上,欢迎分享本文链接,如需转载,请注明出处!

浙公网安备 33010602011771号