Bugfix No Post Processing Volume Crashes Engine
This commit is contained in:
parent
c880eb27ac
commit
985e713659
@ -22,7 +22,6 @@ ATempCharacter::ATempCharacter()
|
||||
GoldBalance = GoldBalance;
|
||||
Health = Health;
|
||||
this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
@ -36,7 +35,10 @@ void ATempCharacter::BeginPlay()
|
||||
|
||||
//MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH
|
||||
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene);
|
||||
if (ensureMsgf(AllActorsInScene.Num() > 0, TEXT("No Post Processing Volume in scene")))
|
||||
{
|
||||
PostProcessVolume = Cast<APostProcessVolume>(AllActorsInScene[0]);
|
||||
}
|
||||
|
||||
Enemy = TEXT("Enemy");
|
||||
UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors);
|
||||
@ -49,6 +51,7 @@ void ATempCharacter::ForwardInput(float Axis)
|
||||
{
|
||||
AddMovementInput(UKismetMathLibrary::GetForwardVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis);
|
||||
}
|
||||
|
||||
//Binds the input we made in the setup player component to the right vector
|
||||
void ATempCharacter::RightMoveInput(float Axis)
|
||||
{
|
||||
@ -61,7 +64,7 @@ void ATempCharacter::Sneak()
|
||||
if (bIsCrouched)
|
||||
{
|
||||
UnCrouch();
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
||||
if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.0f;
|
||||
for (AActor* Actor : AIActors)
|
||||
{
|
||||
USphereComponent* SphereComponent = Actor->FindComponentByClass<USphereComponent>();
|
||||
@ -82,9 +85,8 @@ void ATempCharacter::Sneak()
|
||||
SphereComponent->SetSphereRadius(15.0f);
|
||||
}
|
||||
}
|
||||
PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
||||
if (PostProcessVolume != nullptr) PostProcessVolume->Settings.VignetteIntensity = 0.8f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +117,6 @@ void ATempCharacter::KeyPressed()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Line trace logic
|
||||
void ATempCharacter::LineTraceLogic()
|
||||
{
|
||||
@ -257,7 +258,3 @@ void ATempCharacter::BuyItem()
|
||||
TraceDistance = 1000;
|
||||
LineTraceLogic();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user