I have combed Google and the forum a considerable, tried deleted my dervideddata cache, cleaning & rebuilding the project, nothing works. Upon loading the editor it crashes every single time with this:
[2016.05.10-05.19.04:877][ 0]LogLinux:Error: appError called: Assertion failed: Assertion failed: [File:/home/carlos/MountedHDD/UnrealEngine/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp] [Line: 3228]
Default subobject PawnSensingComponent PawnSensingComp already exists for NormalZombieCharacter /Script/CaveScape.Default__NormalZombieCharacter.
[2016.05.10-05.19.04:914][ 0]LogLinux: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to access memory at address 0x00000003
[2016.05.10-05.19.04:914][ 0]LogLinux: Assertion failed: Assertion failed: [File:/home/carlos/MountedHDD/UnrealEngine/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp] [Line: 3228]
Default subobject PawnSensingComponent PawnSensingComp already exists for NormalZombieCharacter /Script/CaveScape.Default__NormalZombieCharacter.
I only ever call CreateDefaultSubobject<>(); once, and I do it in the constructor. Here are the two source files in question
NormalZombieCharacter.h
#pragma once
#include "GameFramework/Character.h"
#include "NormalZombieCharacter.generated.h"
UCLASS(ABSTRACT)
class ANormalZombieCharacter : public ACharacter
{
GENERATED_BODY()
// For sensing
UPROPERTY(VisibleAnywhere, Category = "AI")
class UPawnSensingComponent* PawnSensingComp; //class
public:
ANormalZombieCharacter(const class FObjectInitializer& ObjectInitializer);
// Called every frame.
virtual void Tick(float DeltaSeconds) override;
UPROPERTY(EditDefaultsOnly, Category = "AI")
class UBehaviorTree* BehaviorTree;
// Stats about the zombie
int Health;
int Damage;
float MeleeStrikeCooldown;
float SprintingSpeedModifier;
// Functions that do "things"
UFUNCTION()
void OnSeePlayer(APawn* Pawn);
UFUNCTION()
void OnMeleeCompBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
UFUNCTION()
void OnRetriggerMeleeStrike();
/* Timer handle to manage continous melee attacks while in range of a player */
FTimerHandle TimerHandle_MeleeAttack;
// For collision detection
UCapsuleComponent* MeleeCollisionComp;
void BeginPlay() override;
};
NormalZombieCharacter.cpp
#include "CaveScape.h"
#include "NormalZombieCharacter.h"
#include "ZombieAIController.h"
// For sensing
#include "Perception/PawnSensingComponent.h"
ANormalZombieCharacter::ANormalZombieCharacter(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Health = 100.f;
Damage = 10.f;
/* Our sensing component to detect players by visibility and noise checks. */
PawnSensingComp = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("Senses")); // ObjectInitializer.
PawnSensingComp->SetPeripheralVisionAngle(60.0f);
PawnSensingComp->SightRadius = 2000;
/* Our sensing component to detect players by visibility and noise checks. */
// PawnSensingComp->HearingThreshold = 600;
// PawnSensingComp->LOSHearingThreshold = 1200;
/* Ignore this channel or it will absorb the trace impacts instead of the skeletal mesh */
// GetCapsuleComponent()->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Ignore); // Need to sort this out in the future
GetCapsuleComponent()->SetCapsuleHalfHeight(96.0f, false);
GetCapsuleComponent()->SetCapsuleRadius(42.0f);
/* These values are matched up to the CapsuleComponent above and are used to find navigation paths */
GetMovementComponent()->NavAgentProps.AgentRadius = 42;
GetMovementComponent()->NavAgentProps.AgentHeight = 192;
MeleeCollisionComp = CreateDefaultSubobject<UCapsuleComponent>(TEXT("MeleeCollision"));
MeleeCollisionComp->SetRelativeLocation(FVector(45, 0, 25));
MeleeCollisionComp->SetCapsuleHalfHeight(60);
MeleeCollisionComp->SetCapsuleRadius(35, false);
MeleeCollisionComp->SetCollisionResponseToAllChannels(ECR_Ignore);
MeleeCollisionComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
MeleeCollisionComp->AttachParent = GetCapsuleComponent();
// If we ever add audio
// AudioLoopComp = CreateDefaultSubobject<UAudioComponent>(TEXT("ZombieLoopedSoundComp"));
// AudioLoopComp->bAutoActivate = false;
// AudioLoopComp->bAutoDestroy = false;
// AudioLoopComp->AttachParent = RootComponent;
MeleeStrikeCooldown = 1.0f;
SprintingSpeedModifier = 3.0f;
}
void ANormalZombieCharacter::Tick(float DeltaSeconds)
{
// Whatever might need to go here
}
void ANormalZombieCharacter::BeginPlay()
{
Super::BeginPlay();
/* This is the earliest moment we can bind our delegates to the component */
if (PawnSensingComp)
{
PawnSensingComp->OnSeePawn.AddDynamic(this, &ANormalZombieCharacter::OnSeePlayer);
//// PawnSensingComp->OnHearNoise.AddDynamic(this, &AZombieCharacter::OnHearNoise);
}
// if (MeleeCollisionComp)
// {
// MeleeCollisionComp->OnComponentBeginOverlap.AddDynamic(this, &ANormalZombieCharacter::OnMeleeCompBeginOverlap);
// }
// BroadcastUpdateAudioLoop(bSensedTarget);
/* Assign a basic name to identify the bots in the HUD. */
// APlayerState* PS = Cast<APlayerState>(PlayerState);
// if (PS)
// {
// PS->SetPlayerName("Bot");
// PS->bIsABot = true;
// }
}
void ANormalZombieCharacter::OnSeePlayer(APawn* Pawn)
{
// Changed sense
// bSensedTarget = true;
AZombieAIController* AIController = Cast<AZombieAIController>(GetController());
if (AIController)
{
AIController->SetTargetEnemy(Pawn);
}
}
void ANormalZombieCharacter::OnMeleeCompBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
// KEEL HEIM
}
void ANormalZombieCharacter::OnRetriggerMeleeStrike()
{
// KELL HEIM MOAR
}
Even after I comment out the UPawnSensing lines and references to them in the cpp and h files the error continues to happen. I’ve tried adapting a good amount of the source code from the EpicSurvivalGame on GitHub. I have a behaviortree and a blackboard that are ready to be used and contain all the needed information.
Using the Ubuntu 16 LTS, Clang 3.8.0, v4.11 UE4:
Full Log