Blueprint child of CPP class crash editor

Well i got a classes Controller, CharacterPawn, Movement & CameraManager in C++ and a based BP from the CharacterPawn Class of C++ after generate the BP i got a crash with the engine.

*This after add the Camera Class in the C++
Files:
FPCharacterPawn.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#include "FOS2015.h"
#include "FPCharacterPawn.h"
#include "FPCharacterMovementComponent.h"

// Sets default values
AFPCharacterPawn::AFPCharacterPawn( const FObjectInitializer& ObjectInitializer ) //: Super( ObjectInitializer ) {
	: Super( ObjectInitializer.SetDefaultSubobjectClass<UFPCharacterMovementComponent>( AFPCharacterPawn::CharacterMovementComponentName ) ) {
	// 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;

}

// Called when the game starts or when spawned
void AFPCharacterPawn::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void AFPCharacterPawn::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

// Called to bind functionality to input
void AFPCharacterPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	Super::SetupPlayerInputComponent(InputComponent);

}

FPCharacterPawn.h:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Character.h"
#include "FPCharacterPawn.generated.h"

UCLASS( Abstract )
class FOS2015_API AFPCharacterPawn : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	//AFPCharacterPawn();
	AFPCharacterPawn( const FObjectInitializer& ObjectInitializer );

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
	
};

FPCharacterMovementComponent.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#include "FOS2015.h"
#include "FPCharacterMovementComponent.h"

UFPCharacterMovementComponent::UFPCharacterMovementComponent( const FObjectInitializer& ObjectInitializer ) : Super( ObjectInitializer ) {

}

FPCharacterMovementComponent.h:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/CharacterMovementComponent.h"
#include "FPCharacterMovementComponent.generated.h"

/**
 * 
 */
UCLASS()
class FOS2015_API UFPCharacterMovementComponent : public UCharacterMovementComponent
{
	GENERATED_BODY()
	
public:
	UFPCharacterMovementComponent( const FObjectInitializer& ObjectInitializer );
	
	
};

FPCameraManager.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#include "FOS2015.h"
#include "FPCameraManager.h"



AFPCameraManager::AFPCameraManager( const FObjectInitializer& ObjectInitializer ) : Super( ObjectInitializer ) {
}

void AFPCameraManager::UpdateCamera( float DeltaTime ) {
	Super::UpdateCamera( DeltaTime );
}

FPCameraManager.h:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Camera/PlayerCameraManager.h"
#include "FPCameraManager.generated.h"

/**
 * 
 */
UCLASS()
class FOS2015_API AFPCameraManager : public APlayerCameraManager
{
	GENERATED_BODY()
	
public:
	AFPCameraManager( const FObjectInitializer& ObjectInitializer );

	/** After updating camera, inform pawn to update 1p mesh to match camera's location&rotation */
	virtual void UpdateCamera( float DeltaTime ) override;
	
};

Log: https://dl.dropboxusercontent.com/u/28070491/UE/Forums/FOS2015.log looks like fail the movementcomponent but no idea about how fix that.

Hi Hevedy,

I have looked into your crash that you’re experiencing but I am unable to reproduce it myself with the provided informaiton.

To be clear about what I have tried, I made a new project of the C++ type with basic code and starter content enabled. I then created 3 C++ classes with the same names as the ones that you have provided code for. I then copy/pasted all of the code that you provided into the files that they belong to and compiled. After that I made a blueprint based off the FPCharacterPawn class and added it to the level. I also went to the blueprint editor and added a few functions.

If there is anything that I am missing or any additional information you can provide, I’d be happy to look into this crash further.

Have a nice day

Well i going to give you all the cpp files, i got the crash at open the BP, in the log i see a problem about the movement component:

[2015.04.30-12.16.48:670][  0]LogLinker:Error: Failed import: class 'FPCharacterMovementComponent' name 'CharMoveComp' outer 'Default__PlayerCharacterPawn_C'. There is another object (of 'CharacterMovementComponent' class) at the path.
[2015.04.30-12.16.48:672][  0]LogLinker:Error: Failed import: class 'FPCharacterMovementComponent' name 'CharMoveComp' outer 'Default__PlayerCharacterPawn_C'. There is another object (of 'CharacterMovementComponent' class) at the path.

My Files: https://dl.dropboxusercontent.com/u/28070491/UE/Forums/Game.7z
*The folder Game go in the FOS2015/Source/FOS2015/(here) as reference and if you see the code of gamemode you will see where is created the BP and what name have.
*I’m in 4.7.6 and is a FPS CPP Template + this + other things in BPs

If the crash is happening when the blueprint is generated, the issue is most likely in the constructor. I would try changing this part of the code in FPCharacterPawn.cpp:

    AFPCharacterPawn::AFPCharacterPawn( const FObjectInitializer& ObjectInitializer ) //: Super( ObjectInitializer ) {
    	: Super( ObjectInitializer.SetDefaultSubobjectClass<UFPCharacterMovementComponent>( AFPCharacterPawn::CharacterMovementComponentName ) ) {
    	// 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;
}

To:

AFPCharacterPawn::AFPCharacterPawn( const FObjectInitializer& ObjectInitializer )
	: Super( ObjectInitializer)
{
	// 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;
}

It seems like the crash messages are saying that the crash is being caused by the ‘CharacterMovementComponent’ being created twice, which it seems this part of the code is causing that.

If this is not the case and you still need assistance figuring out why this crash is occurring, please let me know and we can delve further into this problem.

Have a nice day,

And then how i set the UFPCharacterMovementComponent class to the pawn ??
Edit: Changed and i get the same crash with the old and with new based BP.

If possible, can you please provide me with the entire project? It seems like I may be missing what is causing the crash because I am still unable to reproduce it after using your code and following your steps.

Well that don’t is possible but i going to export and give an cleanup.
This is the second time by a problem i need send to Epic this project xD
Here you go: https://dl.dropboxusercontent.com/u/28070491/UE/Forums/FOS2015CopyB.7z :slight_smile:
Now looks like give the crash at open all BP.

I need help with this please :frowning:

I’m currently looking into the issue. I have been able to reproduce the issue using your project and it seems to be a memory issue, as it is giving me this message in the crash :

[2015.04.30-12.21.13:580][452]LogWindows: === Critical error: ===
Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.7\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 54]
Ran out of memory allocating 18446744073709551576 bytes with alignment 0

I’ll need more time to find a solution. Thank you for your patience in this matter.

Thanks you for your help and your time ^.^ !
I wait here no problem.

I apologize for the length of time this has taken Hevedy, but I finally found the problem. The issue is with the empty enumerators you have in your /game/game/models, textures, sounds, and audio folders. The way the editor is handling these empty enumerators is what is causing the crash.

I have logged a jira for the issue itself and the reference number is UE-15054.

The workaround at the moment would be to either remove these empty enumerators, rename them to have separate names, or to give them values. If you do decide to do any of these however, I would suggest to edit one enumerator at a time and then save the project as you will most likely crash a few times trying to edit them all.

If you have any issues after attempting this work around, let me know and I’ll be glad to assist you further.

Have a nice day

Hey thanks you for your time and the fix :slight_smile: !!