x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UPawnSensingComponent causes editor load to crash

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

Product Version: UE 4.11
Tags:
cavescape.log (37.2 kB)
more ▼

asked May 10 '16 at 05:53 AM in C++ Programming

avatar image

omega364
6 1 2

avatar image Moss May 10 '16 at 06:13 AM

Have you tried re-saving your content? And using the non-ObjectInitializer ctor?

avatar image omega364 May 10 '16 at 02:01 PM

I can't re-save the content because the editor does not boot up at all. It crashes during it's startup procedures.

I haven't seen any up-to-date answers for this version of unreal on using NewObject<>() as opposed to CreateDefaultSubobject<>().

It is worth noting i JUST fixed this answer. Our project is posted to a gitlab repo. I pushed the changed Zombie files to our repo, deleted, and then recloned the ENTIRE repo (3.3 GBs). Anyone cloning the repo does not have this error.

This would tell me that the problem is however the engine is caching data, possibly for quick assest loading or discovery, is causing a crash. If the accidentally had two CreateDefaultSubobjects in a previous form of the code (and i did), the engine won't update it's cached data if it refuses to boot.

I would ask that someone from the unreal staff check this out.

avatar image Moss May 11 '16 at 07:31 AM

If that happens you can tell the engine to null the previous one on startup. That can be done by setting an ActiveClassRedirects to an empty NewClassName. These should be added to your DefaultEngine.ini, check the engines BaseEngine.ini for some existing examples.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question