Hitting Play Crashes UE4

Hello, everything was fine up until lecture 83. Somewhere while adding the DebugDrawLine and including the required header (not shown in the video). UE4.19 began to crash no matter how many times I closed out, restarted, removed the line debug code plus the #include “DrawDebugHelpers.h”

UPDATE! :Removing grabber component from pawn allowed me to play the game so the problem is in grabber.cpp/.h somewhere.
UPDATE!! : I Fixed it!! may have been header include order of ‘include what you use’ (I wish they would include some UE 4.19 notes on that. Cheers :slight_smile: )

This is my code as it stands after commenting out the 2 lines pretaining to DebugDrawLine

// Paul Maguire 2019
#include “Grabber.h”
#include “GameFramework/Actor.h”
#include “GameFramework/Pawn.h”
#include “Engine/World.h”
#include “GameFramework/PlayerController.h”
// #include “DrawDebugHelpers.h”

// In order to make the &out parameters easier to read on void function we are defining an empty substitution which allows &out compiling
// without changing our initial references to the variables.

// Sets default values for this component’s properties
UGrabber::UGrabber()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
PrimaryComponentTick.bCanEverTick = true;
// …
}

// Called when the game starts
void UGrabber::BeginPlay()
{
Super::BeginPlay();
Owner = GetOwner();
ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
// …

}

// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

// Get the player viewpoint per tick
FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(PlayerViewPointLocation, PlayerViewPointRotation);
// Ray cast out from the character a certain distance
// UE_LOG(LogTemp, Warning, TEXT("Player Forward Location : %s Rotation : %s "), *PlayerViewPointLocation.ToString(), *PlayerViewPointRotation.ToString());
FVector LineTraceEnd = PlayerViewPointLocation + FVector(0.f, 60.f, 0.f);

// Draw Red Line
//DrawDebugLine(GetWorld(), PlayerViewPointLocation, LineTraceEnd, FColor(255,0,0), false, 0.f, 0.f, 10.f);
// Check if the raycast intersects a
// GetWorld()->LineBatcher->DrawLine(PlayerViewPointLocation, LineTraceEnd, FColor(255, 0, 0), 0, 1.f, 1.f);
// Log out to variable

}


The game compiles fine in both UE and VS 2017 yet crashes with this output window at the end.

urc_s02_using_include_and_namespaces

LoginId:(hidden)
EpicAccountId:(hidden)

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Engine!FPrimitiveSceneProxy::UpdateUniformBuffer() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\engine\private\primitivesceneproxy.cpp:257]
UE4Editor_Renderer!FRelevancePacket::RenderThreadFinalize() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\scenevisibility.cpp:1866]
UE4Editor_Renderer!ComputeAndMarkRelevanceForViewParallel() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\scenevisibility.cpp:1974]
UE4Editor_Renderer!FSceneRenderer::ComputeViewVisibility() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\scenevisibility.cpp:2813]
UE4Editor_Renderer!FDeferredShadingSceneRenderer::InitViews() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\scenevisibility.cpp:3072]
UE4Editor_Renderer!FDeferredShadingSceneRenderer::Render() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\deferredshadingrenderer.cpp:593]
UE4Editor_Renderer!RenderViewFamily_RenderThread() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\renderer\private\scenerendering.cpp:2749]
UE4Editor_Renderer!TGraphTask<FRendererModule::BeginRenderingViewFamily'::33’::EURCMacro_FDrawSceneCommand>::ExecuteTask() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:829]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:665]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:574]
UE4Editor_RenderCore!RenderingThreadMain() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:331]
UE4Editor_RenderCore!FRenderingThread::Run() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:465]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build++ue4+release-4.19+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

Hey I see you solved the issue, but I thought I’d let you know that as far as I know, in your header files you want the .generated.h to be the last include, and in you implementation file you want to include it’s own header file first. Someone who knows more might be able to have a little more info on that though!

Hi, I have a similar issue to this whilst doing CowBull. I’ve added the following line:

PrintLine(TEXT(“You have %s lives”), Lives);

Every time I click play it crashes, but if I comment out the above line it runs fine. Any ideas?

Privacy & Terms