【发布时间】:2022-07-18 23:06:53
【问题描述】:
不知道是软件问题还是我令人难以置信的编程技能。 我在 C++ 项目中使用 UE4.27 和 Rider for UE 2021.2.1。最近我遇到了一些奇怪的错误或其他问题:代码中的某些更改不会以任何方式影响程序。例如,旧日志(无法获取所有者 Actor、AttackMontageN)仍然可以正常工作,而新日志 (NewLog) 无法正常工作,但在构建时没有错误、崩溃或类似情况:
void UMeleeAttackAbility::CommitExecute(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo,
const FGameplayAbilityActivationInfo ActivationInfo)
{
Super::CommitExecute(Handle, ActorInfo, ActivationInfo);
const auto Owner = ActorInfo->OwnerActor.Get();
if (!Owner)
{
UE_LOG(LogPRAbilitySystemBase, Error, TEXT("Unable to get Owner Actor"))
K2_EndAbility();
}
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("NewLog"));
const int MontageIndex = rand() % 3;
switch(MontageIndex)
{
case 0:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage1"));
AttackMontage = AttackMontage1;
break;
case 1:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage2"));
AttackMontage = AttackMontage2;
break;
case 2:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage3"));
AttackMontage = AttackMontage3;
break;
default:
break;
}
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("NewLog"));
//...
}
我恢复到一个非常古老的提交,其中代码完全不同,但日志和字符行为中的结果仍然相同。此外,我尝试重建当前项目(在 Advanced Build Actions 中)并做一些其他明显的事情,例如重新启动 UE4/Rider 等。是 Rider 问题还是其他问题?
【问题讨论】:
-
Rider 仍处于试验阶段,最近出现了一些严重的问题(尽管很多错误已在最新补丁中得到修复)。您可以尝试删除中间文件中的二进制文件夹,这将强制重新构建。可能还值得使用右上角的箭头进行更新,以防此问题已得到修复。
-
@George 你好!它有所帮助,但只是暂时的。现在它又发生了。如果我再次删除这些文件夹,第一次编译会成功,但之后所做的更改不起作用。因此,为了以某种方式启动该项目,我每次都必须重复此删除操作。我能用这个做什么?
标签: c++ jetbrains-ide unreal-engine4 rider