# C++ Streaming level Error

**URL:** <https://forums.unrealengine.com/t/c-streaming-level-error/772809>\
**Category:** C++\
**Tags:** streaming-level, unreal-engine, CPP\
**Created:** [February 17, 2023, 10:45am UTC](https://forums.unrealengine.com/t/c-streaming-level-error/772809 "2023-02-17T10:45:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Minty597](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Minty597](https://forums.unrealengine.com/u/Minty597)\
**Post date:** [February 17, 2023, 10:45am UTC](https://forums.unrealengine.com/t/c-streaming-level-error/772809/1 "2023-02-17T10:45:36Z")

</div>

Hi All

Im trying to stream some level files using the following code

```auto
for (FAssetData	Asset : AssetData)
	{
		FStaticConstructObjectParameters params(ULevelStreamingDynamic::StaticClass());
		params.Outer = GetWorld();
		params.Name = NAME_None;
		params.SetFlags = RF_NoFlags;
		params.InternalSetFlags = EInternalObjectFlags::None;
		
		ULevelStreamingDynamic* StreamingLevel = static_cast<ULevelStreamingDynamic*>( StaticConstructObject_Internal(params));

		// Associate a package name.
		StreamingLevel->SetWorldAssetByPackageName(Asset.AssetName);
		if (GetWorld()->IsPlayInEditor())
		{
			FWorldContext WorldContext = GEngine->GetWorldContextFromWorldChecked(GetWorld());
			StreamingLevel->RenameForPIE(WorldContext.PIEInstance);
		}

		StreamingLevel->LevelColor = FColor::MakeRandomColor();
		StreamingLevel->SetShouldBeLoaded(true);
		StreamingLevel->SetShouldBeVisible(true);
		StreamingLevel->bShouldBlockOnLoad = false;
		StreamingLevel->bInitiallyLoaded = true;
		StreamingLevel->bInitiallyVisible = true;

		FTransform A{
			FRotator{}, // Rotation
			FVector{1.0f, 2.0f, 3.0f}, // Translation
			FVector{2.0f, 2.0f, 2.0f} // Scale
		};

		StreamingLevel->LevelTransform = A; // where to put it
		
		StreamingLevel->PackageNameToLoad =Asset.PackageName; // PackageName containing level to load

		UE_LOG(LogLevelGen, Warning, TEXT("trying to loadlevel %s"), *StreamingLevel->PackageNameToLoad.ToString());

		
		FString PackageFileName;
		if( !FPackageName::DoesPackageExist( StreamingLevel->PackageNameToLoad.ToString(), &PackageFileName ) )
		{
			UE_LOG(LogLevelGen, Error, TEXT("trying to load invalid level %s"), *StreamingLevel->PackageNameToLoad.ToString());
			return ;
		}

		StreamingLevel->PackageNameToLoad = FName(*FPackageName::FilenameToLongPackageName(PackageFileName));

		// Add the new level to world.
		GetWorld()->AddStreamingLevel(StreamingLevel );
	}

```

when I run the code, I get the following errors  
LogLevelStreaming: Warning: Streaming Level ‘/Game/UEDPIE\_0\_CPPTest.CPPTest:LevelStreamingDynamic\_2’ uses same destination for level (‘’) as ‘/Game/UEDPIE\_0\_CPPTest.CPPTest:LevelStreamingDynamic\_0’. Level cannot be loaded again and this StreamingLevel will be flagged as failed to load.

LogLevelStreaming: Warning: Streaming Level ‘/Game/UEDPIE\_0\_CPPTest.CPPTest:LevelStreamingDynamic\_1’ uses same destination for level (‘’) as ‘/Game/UEDPIE\_0\_CPPTest.CPPTest:LevelStreamingDynamic\_0’. Level cannot be loaded again and this StreamingLevel will be flagged as failed to load.

What do they mean?  
How do I set the Destination?
