By game crashes when my character runs cone in beginplay()
The problem seems to be coming from my game mode but there is no code only a blueprint with the default pawn changed.
here is the crash log
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000148
UE4Editor_Engine
UE4Editor_EnergySuckers_9891!ATP_Character::BeginPlay() [C:\Users\noahd\Documents\Unreal Projects\EnergySuckers\Source\EnergySuckers\TP_Character.cpp:43]
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
The code on character.Cpp line 43 is BeginPlay()
void ATP_Character::BeginPlay()
{
Super::BeginPlay();
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
Gun = GetWorld()->SpawnActor<AGunBase>(GunClass);
Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("root"));
Gun->SetOwner(this);
InventoryWidget = CreateWidget(GetWorld(), InventoryClass);
if (InventoryWidget != nullptr)
{
InventoryWidget->AddToPlayerScreen();
}
}
I removed all code from the game mode and nothing changed. The game mode is just the generic mode made by Unreal at the creation of the project.