Keep applied quality settings level between runs (special condition for Unreal Editor too)
This commit is contained in:
parent
1c7de39de1
commit
403e9ba797
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue