Memory Access Violation in constructor when all dereferences commented

Error is as follows:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffffffffffff

UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_Overlord_patch_0!Z_Construct_UClass_AGunship() [C:\Users\dante\Code\Unreal\Overlord\Intermediate\Build\Win64\UnrealEditor\Inc\Overlord\Gunship.gen.cpp:315]
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_LiveCoding
UnrealEditor_LiveCoding
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

And here is the constructor code:

AGunship::AGunship()
{
// 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;

//// create the visual mesh
//VisualMesh = CreateDefaultSubobject(TEXT(“Mesh”));
//VisualMesh->SetupAttachment(RootComponent);
////VisualMesh->SetSimulatePhysics(true);

//// set a default mesh of a target
//static ConstructorHelpers::FObjectFinder GunshipVisualAsset(TEXT(“/Game/ExternalContent/VigilanteContent/Vehicles/West_Transport_C130J/SK_West_Transport_C130J.SK_West_Transport_C130J”));
//if (GunshipVisualAsset.Succeeded())
//{
// VisualMesh->SetSkeletalMesh(GunshipVisualAsset.Object);
// VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f));
//}

Viewfinder = CreateDefaultSubobject(TEXT(“CameraComponent”));
//Viewfinder->SetupAttachment(RootComponent);
//FRotator ViewfinderRotation = GetActorRotation();
//ViewfinderRotation.Add(0.0, 90.0, 0.0);
//Viewfinder->SetRelativeLocation(FVector(0.0f, 0.0f, -10.0f));
//Viewfinder->SetRelativeRotation(ViewfinderRotation);
}

The last time I could build without crashing was when I wasn’t using the VisualMesh code and just had the Viewfinder attached to the RootComponent. I tried to uncomment and use the skeletal mesh component as the attach point for the Viewfinder to troubleshoot another issue I was having and then I started getting this error when trying to build with Ctrl+Alt+F11. Is this another scenario where I’ve got to delete the binary/intermediate folders to get Unreal to recognize the changes? Really not sure what could be causing the crash with only that one line of code left in, and I need the Viewfinder to be instantiated to prevent memory access errors in my Tick code later haha…

open your project in visual studio, and hit build.

when you build with live coding, it does not replace the original game files, it creates patch files that get loaded into memory over the top of the originals. To make it work after exiting, you need to build.

I can build that way without issue, but the changes aren’t applied in the project when I do. And then the live coding build continues to crash the unreal session with the above error (though it also seems to log a successful build right before that happens).

Is Visual Studio set to build Development-Editor ? it should be. If not, then it’s building some other version. That’s the usual cause of that problem.

1 Like

Ahh, I was set to DebugGame Editor by default. Rebuilding with the solution config set to Development-Editor while Unreal was closed succeeded and upon reopening the project the changes took effect!

1 Like