AActor::IsInPersistentLevel
#include "GameFramework/Actor.h"
Access: public
Description
Returns whether this actor resides in the persistent level rather than a streaming sublevel. Useful for logic that should only run for persistently-loaded actors.
Caveats & Gotchas
- • An actor placed in a streaming level returns false by default even if that level is currently loaded and active. Pass `bIncludeLevelStreamingPersistent = true` if you use `ULevelStreamingPersistent` and want those actors to be treated as persistent.
- • In World Partition maps the concept of a single persistent level is more nuanced — actors in loaded cells may still return false here.
Signature
ENGINE_API bool IsInPersistentLevel(bool bIncludeLevelStreamingPersistent = false) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bIncludeLevelStreamingPersistent | bool | If true, also counts actors in streaming levels that are marked as persistent (ULevelStreamingPersistent). | false |
Return Type
bool Example
Skip logic for sublevel actors C++
void AMyManager::RegisterActor(AActor* Actor)
{
if (!Actor->IsInPersistentLevel())
{
// Actors in sublevels are managed separately
return;
}
PersistentActors.Add(Actor);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?