RealDocs

AActor::EndViewTarget

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtual

Description

Called when a PlayerController stops using this actor as its view target. Also fires the Blueprint event K2_OnEndViewTarget.

Caveats & Gotchas

  • Always call Super::EndViewTarget to ensure the K2_OnEndViewTarget Blueprint event is dispatched. Skipping it breaks Blueprint subclasses that override the event.
  • This may fire during actor destruction if the view target is changed by the controller's cleanup code. Check IsValid(this) carefully if you dereference members that may already be destroyed.

Signature

virtual void EndViewTarget( class APlayerController* PC )

Parameters

Name Type Description Default
PC class APlayerController* The PlayerController that is no longer targeting this actor.

Return Type

void

Example

Deactivate a custom effect when this actor is no longer the view target C++
void AMyActor::EndViewTarget(APlayerController* PC)
{
    Super::EndViewTarget(PC);
    PostProcessComponent->bEnabled = false;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.