UActorComponent::PostApplyToComponent
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtual
Description
Called after ApplyToComponent has run during construction script re-runs. Override to restore state that was cached in GetComponentInstanceData and lost during reconstruction.
Caveats & Gotchas
- • Only called when a component survives a RerunConstructionScripts pass — it is not called on initial component creation.
- • The counterpart GetComponentInstanceData must also be overridden to cache the data you want to restore here; without it, PostApplyToComponent has nothing to act on.
Signature
ENGINE_API virtual void PostApplyToComponent() Return Type
void Example
Restoring cached runtime state after construction script re-run C++
void UMyComponent::PostApplyToComponent()
{
Super::PostApplyToComponent();
// Re-apply any runtime state that was stored in GetComponentInstanceData
if (CachedMaterial)
{
SetMaterial(0, CachedMaterial);
}
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?