Quick answer: Unreal Construction Script rerun wipes a Blueprint-added component’s runtime state? Override FComponentInstanceDataCache to round-trip the data, or move state out of the component into the actor.
An AI sensor component caches its detected targets; the construction script re-runs on save and the cache resets. The component’s instance data isn’t persisted across reruns.
Construction Reruns Reset Components
Construction Script destroys then re-creates Blueprint-added components. Any runtime state on those components vanishes — this is by design.
Move State to Actor
The simplest fix: store the cache on the owning actor (which survives reruns), not on the component. Components fetch state via their owner.
Custom InstanceData
For complex components, override GetComponentInstanceData and apply via ApplyToComponent. Engine serializes the data across the rebuild.
Native Components Are Stable
Native (C++) components added by code aren’t affected by construction script reruns — only Blueprint-added components.
Verifying
Editing the BP class doesn’t wipe runtime state. Saving / reloading the level preserves cached values.
“Blueprint components are rebuilt on construction. State belongs on the actor or in instance data.”
Use C++ base classes for components that need persistent runtime state — the construction-rerun behavior is much friendlier.