# Why are both of these functions that are supposed to give me level bounds returning a single point at 0,0,0?

**URL:** <https://forums.unrealengine.com/t/why-are-both-of-these-functions-that-are-supposed-to-give-me-level-bounds-returning-a-single-point-at-0-0-0/432757>\
**Category:** World Creation\
**Tags:** Level-Streaming, streaming-level, unreal-engine, bounds, question\
**Created:** [August 30, 2018, 12:15am UTC](https://forums.unrealengine.com/t/why-are-both-of-these-functions-that-are-supposed-to-give-me-level-bounds-returning-a-single-point-at-0-0-0/432757 "2018-08-30T00:15:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HallwayWalker](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HallwayWalker](https://forums.unrealengine.com/u/HallwayWalker)\
**Post date:** [August 30, 2018, 12:15am UTC](https://forums.unrealengine.com/t/why-are-both-of-these-functions-that-are-supposed-to-give-me-level-bounds-returning-a-single-point-at-0-0-0/432757/1 "2018-08-30T00:15:40Z")

</div>

I’m trying to get movable objects to become part of the level they’re in when it unloads so they don’t just fall into the void (I’m using world composition if it matters). As far as I can find it can only be done with C++ so I started using it and created a LevelScriptActor class and I’m trying to do this:

```
void AMyLevelScriptActor::EndPlay(const EEndPlayReason::Type EndPlayReason) {
	this->MoveActors();
	Super::EndPlay(EndPlayReason);
}

void AMyLevelScriptActor::MoveActors()
{
	ULevelStreaming *ThisLevelStreaming = FLevelUtils::FindStreamingLevel(this->GetLevel());
	ULevel *LoadedLevel = ThisLevelStreaming->GetLoadedLevel();
	//FBox LevelBounds = ALevelBounds::CalculateLevelBounds(LoadedLevel);
	FBox LevelBounds = ThisLevelStreaming->GetStreamingVolumeBounds();
	FString debug = ThisLevelStreaming->GetWorldAssetPackageName() + " - " + LevelBounds.Min.ToString() + " - MAX " + LevelBounds.Max.ToString();

	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, debug);

```

This prints the name of the level that’s unloading correctly but both Min and Max are 0,0,0 so my objects will never be inside it, whether I use the commented out LevelBounds or the other one.

I learned most of this from these links:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![HallwayWalker](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HallwayWalker](https://forums.unrealengine.com/u/HallwayWalker)\
**Post date:** [August 30, 2018, 1:45am UTC](https://forums.unrealengine.com/t/why-are-both-of-these-functions-that-are-supposed-to-give-me-level-bounds-returning-a-single-point-at-0-0-0/432757/2 "2018-08-30T01:45:50Z")

</div>

I’ve discovered it prints something other than 0s if the level unloaded because I’m loading my game/opening the persistent level again, but I don’t know why or if that can help me in some way.

---

<div class="post-metadata">

**Author:** ![HallwayWalker](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HallwayWalker](https://forums.unrealengine.com/u/HallwayWalker)\
**Post date:** [August 30, 2018, 3:59pm UTC](https://forums.unrealengine.com/t/why-are-both-of-these-functions-that-are-supposed-to-give-me-level-bounds-returning-a-single-point-at-0-0-0/432757/3 "2018-08-30T15:59:32Z")

</div>

It works if I get the bounds on beginplay, using

```
LevelBounds = ALevelBounds::CalculateLevelBounds(LoadedLevel);

```

Even though everything I’ve found indicates EndPlay fires before anything is actually unloaded so I don’t see why getting the bounds then should be any different…
