RealDocs

APawn::ShouldTickIfViewportsOnly

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverrideconst

Description

Returns whether this pawn should tick while the editor is open but not in Play-in-Editor mode (viewport-only). APawn's implementation returns true if the pawn is locally controlled, so player-controlled pawns stay responsive in editor previews.

Caveats & Gotchas

  • Returning true from this function in a subclass means Tick() will be called in the editor outside of PIE. Any Tick logic that assumes a fully initialized game world can cause crashes or incorrect state in the editor.
  • This is an engine scaffolding method — overriding it is rarely necessary and should be done with careful consideration of the editor tick implications.

Signature

virtual bool ShouldTickIfViewportsOnly() const override;

Return Type

bool

Example

Suppress editor ticking for a custom pawn C++
bool AMyEditorSafePawn::ShouldTickIfViewportsOnly() const
{
	// Never tick outside PIE, even if locally controlled
	return 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.