I am trying to make a custom GameUserSettings
class inside of a plugin, coded it and modified DefaultEngine.ini
to use my custom class instead of the default one. Now I get this error whenever I try opening my project:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000240
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_JourneyFrameworkMainMenuSystem!UJF_GameUserSettings::ApplyAdvancedSettings() [C:\Users\dan00\Documents\Unreal Plugins\JourneyFramework\Plugins\JourneyFrameworkMainMenuSystem\Source\JourneyFrameworkMainMenuSystem\Private\Misc\JF_GameUserSettings.cpp:36]
UE4Editor_JourneyFrameworkMainMenuSystem!UJF_GameUserSettings::ApplySettings() [C:\Users\dan00\Documents\Unreal Plugins\JourneyFramework\Plugins\JourneyFrameworkMainMenuSystem\Source\JourneyFrameworkMainMenuSystem\Private\Misc\JF_GameUserSettings.cpp:21]
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
my source code for the infringing methods is this:
void UJF_GameUserSettings::ApplySettings(bool bCheckForCommandLineOverrides) {
Super::ApplyNonResolutionSettings();
ApplyAdvancedSettings();
Super::ApplyResolutionSettings(bCheckForCommandLineOverrides);
SaveConfig();
}
and this is ApplyAdvancedSettings:
void UJF_GameUserSettings::ApplyAdvancedSettings() {
//Misc
if (bEnableBloom) {
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.Bloom 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.Bloom 0"));
}
if (bMotionBlur) {
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.MotionBlur 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.DefaultFeature.MotionBlur 0"));
}
//Check for ray tracing
if (bRayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing 1"));
}
else {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing 0"));
}
if (bRayTracing && ShadowsType == EShadowsType::RayTraced && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Shadows 1"));
}
else {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Shadows 0"));
}
if (bRayTracing && AmbientOcclusionType == EAmbientOcclusionType::RayTraced && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.AmbientOcclusion 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.AmbientOcclusion 0"));
}
if (bRayTracing && ReflectionsType == EReflectionsType::RayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Reflections 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Reflections 0"));
}
if (bRayTracing && TranslucencyType == ETranslucencyType::RayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Translucency 1"));
}
else
{
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.Translucency 0"));
}
switch (GIType)
{
case EGlobalIlluminationType::Off:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 0"));
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality 0"));
break;
case EGlobalIlluminationType::RayTraced:
if (bRayTracing && GRHISupportsRayTracing) {
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality 0"));
switch (RTGIType)
{
case ERayTracingGlobalIlluminationType::FinalGather:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 1"));
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination.EnableFinalGather 1"));
break;
case ERayTracingGlobalIlluminationType::BruteForce:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 1"));
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination.EnableFinalGather 0"));
break;
default:
break;
}
break;
}
else
{
break;
}
case EGlobalIlluminationType::ScreenSpace:
GetWorld()->Exec(GetWorld(), TEXT("r.RayTracing.GlobalIllumination 0"));
GetWorld()->Exec(GetWorld(), TEXT("r.SSGI.Quality " + UKismetMathLibrary::Clamp(ScreenSpaceGIQuality, 1, 4)));
break;
default:
break;
}
}
this is what i included in the .cpp file:
#include "Misc/JF_GameUserSettings.h"
#include "GameFramework/GameUserSettings.h"
#include "AudioDevice.h"
#include "Engine/Engine.h"
#include "Kismet/KismetMathLibrary.h"
#include "RHI.h"
I am happy to provide more source code if it helps!