RealDocs

UActorComponent::NeedsLoadForEditorGame

function Engine Since 4.14
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualoverride

Description

Returns whether this component must be loaded when running the game from the editor (Play-In-Editor). Components that only affect the editor viewport but not PIE gameplay should return false.

Caveats & Gotchas

  • Returning false strips this component from PIE sessions, which can cause null pointer issues if other components or Blueprints assume it exists — ensure callers handle the missing component gracefully.
  • This is queried during cooking and PIE setup; it is not called at runtime in packaged builds where the standard NeedsLoadForClient/Server flags govern loading.
  • The UActorComponent base implementation calls the owner actor's NeedsLoadForEditorGame — override with caution to avoid diverging from the actor's own load policy.

Signature

ENGINE_API virtual bool NeedsLoadForEditorGame() const override;

Return Type

bool

Example

Exclude an editor-only visualizer component from PIE C++
bool UMyEditorVisualizerComponent::NeedsLoadForEditorGame() const
{
    // This component is only for editor viewport display; skip it in PIE
    return false;
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.