Keep applied quality settings level between runs (special condition for Unreal Editor too)

This commit is contained in:
CVC\jbelon 2018-03-21 12:37:47 +01:00
parent 1c7de39de1
commit 403e9ba797
5 changed files with 25 additions and 2 deletions

View File

@ -199,6 +199,15 @@ void ACarlaGameModeBase::BeginPlay()
GameController->BeginPlay();
}
void ACarlaGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
if(CarlaSettingsDelegate!=nullptr && EndPlayReason==EEndPlayReason::EndPlayInEditor)
{
CarlaSettingsDelegate->Reset();
}
}
void ACarlaGameModeBase::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);

View File

@ -38,6 +38,8 @@ public:
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void Tick(float DeltaSeconds) override;
FDataRouter &GetDataRouter()

View File

@ -11,11 +11,20 @@
#include "Engine/PostProcessVolume.h"
#include "UObjectIterator.h"
///quality settings configuration between runs
EQualitySettingsLevel UCarlaSettingsDelegate::AppliedLowPostResetQualitySettingsLevel = EQualitySettingsLevel::Epic;
UCarlaSettingsDelegate::UCarlaSettingsDelegate() :
ActorSpawnedDelegate(FOnActorSpawned::FDelegate::CreateUObject(this, &UCarlaSettingsDelegate::OnActorSpawned))
{
}
void UCarlaSettingsDelegate::Reset()
{
LaunchEpicQualityCommands(GetLocalWorld());
AppliedLowPostResetQualitySettingsLevel = EQualitySettingsLevel::Epic;
}
void UCarlaSettingsDelegate::RegisterSpawnHandler(UWorld *InWorld)
{
CheckCarlaSettings(InWorld);

View File

@ -21,6 +21,9 @@ public:
/** Constructor */
UCarlaSettingsDelegate();
/** Reset settings to default */
void Reset();
/** Create the event trigger handler for all new spawned actors to be processed with a custom function here */
void RegisterSpawnHandler(UWorld *World);
@ -65,7 +68,7 @@ private:
private:
/** currently applied settings level after level is restarted */
EQualitySettingsLevel AppliedLowPostResetQualitySettingsLevel = EQualitySettingsLevel::Epic;
static EQualitySettingsLevel AppliedLowPostResetQualitySettingsLevel;
/** */
UCarlaSettings* CarlaSettings = nullptr;

View File

@ -90,7 +90,7 @@ void AVehicleSpawnerBase::SetNumberOfVehicles(const int32 Count)
void AVehicleSpawnerBase::TryToSpawnRandomVehicle()
{
auto SpawnPoint = GetRandomSpawnPoint();
if ((SpawnPoint != nullptr)) {
if (SpawnPoint != nullptr) {
SpawnVehicleAtSpawnPoint(*SpawnPoint);
} else {
UE_LOG(LogCarla, Error, TEXT("Unable to find spawn point"));