Hi all,
I have been making my own game but have run into some crashing issues when trying to create a blueprint class from a custom c++ class.
Basically I have a some code which inits a basic StaticMesh and SphereComponent and then checks for collision with PlayerPawn. first time I made BP class and added to my scene it worked fine, but when I tried to reopen BP it crashed and all times after that would crash when trying to remake BP class (specifically when I try to add a Mesh in BP editor).
This crash seems to have only really started recently (it worked fine for ages before) and I am wondering if anyone has any idea of a potential solution?
Just incase it’s relevant - my laptop is really,really terrible, has basically no RAM (4GB) and uses Windows 7, can this be a potential cause of crash?
Also error report is standard Access Violation one which a lot of people seem to encounter.
Thanks in advance for any help =)
Hi Chewy,
I’ve assigned a member of our support staff to look into this for you, and they’ll let you know if they require more information. In meantime, please let us see code you used in the .h and .cpp files for this custom class.
Then, please attach your dxdiag, and log from project’s Saved\Logs folder after crash occurs. We could also use information in Crash Reporter window, including MachineID, so we can look it up here. Thanks!
Hey -
Could you upload callstack and log file for crash as well as code class that your blueprint is based on? Additionally can you post your machines DXDiag as well? Also, to make sure I’m following along clearly, you are crashing when you create a blueprint based on C++ class?
Cheers
Hey ,
Cheers for response =)
Firstly here is DxDiag, I will post rest when UE boots up (am not joking when I say my laptop is garbage, it takes a while =P).
To answer your question - first time I create it, it works! But when I try to re-open blueprint, it crashes. I then delete and re-create blueprint based on my custom class, then when I add a static mesh component (say a Shape_Sphere from startercontent, it crashes).
Here is code I used
GameplayExampleTriggerObj.cpp:
include “GameplayExample.h”
include “GameplayExampleTriggerObj.h”
include “Engine.h”
include “GameplayExampleCharacter.h”
include “GameplayExampleHUD.h”
include “GameplayExampleProjectile.h”
// Sets default values
AGameplayExampleTriggerObj::AGameplayExampleTriggerObj(const FObjectInitializer& ObjInit)
: Super(ObjInit)
{
Mesh = ObjInit.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh"));
RootComponent = Mesh;
ProxSphere = ObjInit.CreateDefaultSubobject<USphereComponent>(this, TEXT("ProxSphere"));
ProxSphere->OnComponentBeginOverlap.AddDynamic(this, &AGameplayExampleTriggerObj::Prox);
ProxSphere->AttachTo(RootComponent);
}
// Called when game starts or when spawned
void AGameplayExampleTriggerObj::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AGameplayExampleTriggerObj::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
void AGameplayExampleTriggerObj::Prox_Implementation( AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult)
{
AGameplayExampleCharacter* Player = Cast<AGameplayExampleCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (OtherComp == Player->ProxSphere)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Black, "Overlap ProxSphere Test");
}
}
}
Hey -
Looking at DXDiag it seems your laptop is indeed below recommended specifications for developing with engine. For more information on recommended specs you can check out this link or check out forums and see what hardware other community members are using.
A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
Cheers
Hey ,
Yeah I thought as much. code I used is pretty simple and has worked previously (it keeps crashing pretty randomly and without warning).
I think I am going to test it on a more powerful machine too =)
Cheers,
Hi ,
I managed to repeat crash on a more powerful laptop which would suggest it maybe isn’t system related. I am going to post code class which I am making a BP from - can you let me know if anything silly is going on here?
.cpp:
AGameplayExampleTriggerObj::AGameplayExampleTriggerObj()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
RootComponent = Mesh;
ProxSphere = CreateAbstractDefaultSubobject<USphereComponent>(TEXT("Proximity Sphere"));
ProxSphere->AttachTo(RootComponent);
ProxSphere->OnComponentBeginOverlap.AddDynamic(this, &AGameplayExampleTriggerObj::Prox);
}
// Called when game starts or when spawned
void AGameplayExampleTriggerObj::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AGameplayExampleTriggerObj::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
void AGameplayExampleTriggerObj::Prox_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult)
{
AGameplayExampleCharacter* Player = Cast<AGameplayExampleCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (OtherComp == Player->CapsuleComponent)
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(0, 2.0f, FColor::Black, "Overlap test");
}
}
}
.h
#include "GameFramework/Actor.h"
#include "GameplayExampleTriggerObj.generated.h"
UCLASS()
class GAMEPLAYEXAMPLE_API AGameplayExampleTriggerObj : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AGameplayExampleTriggerObj();
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = Collision)
USphereComponent* ProxSphere;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = Collision)
UStaticMeshComponent* Mesh;
UFUNCTION(BlueprintNativeEvent, Category = Collision)
void Prox(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult);
void Prox_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult);
// Called when game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};
Hey -
I tried adding code you posted to an actor class and was able to create / open / close / reopen a blueprint based on this class. Can you post DXDiag for second laptop you used as well as callstack and log files (in project’s Saved/Logs folder) from crash?
Hey ,
It seems to work now? I changed way I created my BP class (via Blueprint dropdown rather than via class viewer tab). I also saved BP pre running (although not sure whether this really makes any difference}