UActorComponent::ComponentIsInPersistentLevel
#include "Components/ActorComponent.h"
Access: public
Specifiers: const
Description
Returns true if this component is in the world's persistent level. Optionally also returns true for streaming levels flagged as persistently loaded.
Caveats & Gotchas
- • The bIncludeLevelStreamingPersistent parameter causes the function to return true even for streaming sub-levels when they are marked as always loaded, which can give unexpected results if you assume 'persistent' means the main map file only.
- • In multiplayer, the persistent level is shared, but streaming levels may differ per player. Treat this result as world-server truth; do not use it for per-client presence checks.
Signature
ENGINE_API bool ComponentIsInPersistentLevel(bool bIncludeLevelStreamingPersistent) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bIncludeLevelStreamingPersistent | bool | If true, also returns true for components in levels marked as persistent via ULevelStreaming::bDisableDistanceStreaming. | — |
Return Type
bool Example
Check if a component is in the persistent level C++
if (MyComponent->ComponentIsInPersistentLevel(false))
{
// Component is in the main map level, not a streaming sublevel
UE_LOG(LogTemp, Log, TEXT("Component is persistent"));
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?