【发布时间】:2020-06-28 05:19:22
【问题描述】:
在虚幻引擎 4 中,当我被告知我没有正确更新计算机上的项目,需要从源代码管理中获取当前文件时,我正在处理一些 c++ 文件作为游戏开发项目的一部分到我的计算机的项目实例上以继续工作。这需要覆盖 c++ 文件,所以我备份了我制作的 c++ 文件,并在更新项目后重新实现了它们。当一切都说完了,我得到了以前从未见过的错误:
ERROR: Unable to merge actions producing AICharacter.cpp.obj: prerequisites are different
ERROR: Action graph is invalid; unable to continue. See log for details.
我假设这与我的 AICharacter 源文件有关,所以我将在此处包含它:
#include "AICharacter.h"
#include "MainVillian.h"
#include "Kismet/GameplayStatics.h"
// Sets default values
AAICharacter::AAICharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//Init the box and audio comps
BoxComp = CreateDefaultSubobject<UBoxComponent>(FName("BoxComp"));
BoxComp->AttachTo(GetRootComponent());
AudioComp = CreateDefaultSubobject<UAudioComponent>(FName("AudioComp"));
AudioComp->AttachTo(GetRootComponent());
}
void AAICharacter::OnBoxOverlap(AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherIndex, bool bFromSweep, const FHitResult & SweepResult)
{
if (OtherActor->IsA<AMainVillian>())
{
AMainVillian* Char = Cast<AGV_ProjectCharacter>(OtherActor);
Char->SetTalkRangeStatus(true);
Char->GeneratePlayerLines(*PlayerLines);
Char->SetAssociatedPawn(this);
}
}
void AMainVillian::OnBoxEndOverlap(AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherIndex)
{
if (OtherActor->IsA<AMainVillian>())
{
AMainVillian* Char = Cast<AMainVillian>(OtherActor);
Char->SetTalkRangeStatus(false);
Char->SetAssociatedPawn(nullptr);
}
}
// Called when the game starts or when spawned
void AAICharacter::BeginPlay()
{
Super::BeginPlay();
//Register the begin and end overlap functions
BoxComp->OnComponentBeginOverlap.AddDynamic(this, &AAICharacter::OnBoxOverlapWrapper);
BoxComp->OnComponentEndOverlap.AddDynamic(this, &AAICharacter::OnBoxEndOverlapWrapper);
}
// Called every frame
void AAICharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AAICharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
void AAICharacter::Talk(USoundBase* SFX, TArray<FSubtitle> Subs)
{
AMainVillian* Char = Cast<AMainVillian>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
//Play the corresponding sfx
AudioComp->SetSound(SFX);
AudioComp->Play();
//Tell the UI to update with the new subtitles
Char->GetUI()->UpdateSubtitles(Subs);
}
void AAICharacter::AnswerToCharacter(FName PlayerLine, TArray<FSubtitle>& SubtitlesToDisplay, float delay)
{
if (!AILines) return;
//Retrieve the corresponding line
FString ContextString;
FDialogStruct* DialogStruct = AILines->FindRow<FDialogStruct>(PlayerLine, ContextString);
AMainVillian* MainChar = Cast<AMainVillian>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (DialogStruct && MainChar)
{
FTimerHandle TimerHandle;
FTimerDelegate TimerDel;
TimerDel.BindUFunction(this, FName("Talk"), DialogStruct->SFX, DialogStruct->Subtitles);
//Talk to the player after the delay time has passed
GetWorld()->GetTimerManager().SetTimer(TimerHandle, TimerDel, delay, false);
}
}```
【问题讨论】:
-
您查看日志了解详情了吗?
-
我认为它与源文件的 content 没有任何关系。这些错误看起来像源代码控制错误消息。执行该更新时,您似乎做错了什么。
-
似乎this dude 收到了重复源文件的错误。
标签: c++ unreal-engine4