同一个项目 ToonTanks 在 UE4 中声音正常,但当我迁移到 UE5 时,没有射弹声音。
在projectile.h中我声明了这样的声音
UPROPERTY(EditAnywhere, Category="combat")
USoundBase* LaunchSound;
我将其设置在蓝图中,然后在projectile.cpp BeginPlay中我像这样播放声音
if (LaunchSound) {
UGameplayStatics::PlaySoundAtLocation(this, LaunchSound, GetActorLocation());
}
当我按下停止按钮时,编辑器正常输出声音,我也尝试过 FPS 演示,它在游戏中正常有声音。我调试了这个游戏,执行进去了
if
但是没有声音。有什么建议吗?
使用以下步骤修复:
1-Delete the folder Intermediate
2-Right click the uproject file and select generate vs files
3-open rider and choose for ex development editor build
4-wait until rider update source files
5-build from rider
6-open UE5 editor and run and sound work as expected.
是的,它仍然在 UE 5.2 中重现。