RealDocs

UActorComponent::UninitializeComponent

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtual

Description

Called from AActor::EndPlay only if InitializeComponent was previously called. Override to release any resources or references acquired during InitializeComponent.

Caveats & Gotchas

  • Only called if bHasBeenInitialized is true, which requires bWantsInitializeComponent to have been true. If you override UninitializeComponent without also overriding InitializeComponent (and setting bWantsInitializeComponent), it will never be called.
  • This is called before EndPlay in the component lifecycle, during EndPlay of the owning actor. Do not rely on other components still being valid here — they may already be uninitializing in an undefined order.

Signature

ENGINE_API virtual void UninitializeComponent()

Return Type

void

Example

Override UninitializeComponent to release resources C++
void UMyComponent::UninitializeComponent()
{
	// Release anything acquired in InitializeComponent
	CachedReference = nullptr;
	Super::UninitializeComponent();
}

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.