AActor::BecomeViewTarget
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Called when a PlayerController sets this actor as its view target. Also fires the Blueprint event K2_OnBecomeViewTarget.
Caveats & Gotchas
- • This is called on the server and on locally controlled clients, but not on simulated proxies. If you need camera setup logic to run everywhere, do it in BeginPlay or a replicated variable callback instead.
- • Calling Super::BecomeViewTarget is required — it triggers the K2_OnBecomeViewTarget Blueprint event. Skipping it breaks Blueprint overrides.
Signature
virtual void BecomeViewTarget( class APlayerController* PC ) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| PC | class APlayerController* | The PlayerController that is now targeting this actor as its view target. | — |
Return Type
void Example
Activate a custom effect when the player views this actor C++
void AMyActor::BecomeViewTarget(APlayerController* PC)
{
Super::BecomeViewTarget(PC);
// Activate a post-process effect specific to this view target
PostProcessComponent->bEnabled = true;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?