# Level translation when streaming not working

**URL:** <https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991>\
**Category:** World Creation\
**Tags:** Level-Streaming, unreal-engine, question\
**Created:** [June 16, 2015, 11:56am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991 "2015-06-16T11:56:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_2db7ca80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2db7ca80](https://forums.unrealengine.com/u/anonymous_user_2db7ca80)\
**Post date:** [June 16, 2015, 11:56am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/1 "2015-06-16T11:56:14Z")

</div>

[This question explains & answer how to stream in a level at a location](https://answers.unrealengine.com/questions/138027/level-stream-can-i-change-the-location-of-a-stream.html). As described, I set the LevelTransform on the StreamingLevel before requesting it to be loaded. However, despite the transform being correct, the level is still based around the origin.

Digging in to it I see that when we come to `UWorld::AddToWorld`, the `bAlreadyMovedActors` flag has been set to true so the transform is never applied. Further looking reveals it gets set to true in this bit of code:

```
UWorld* PIELevelWorld = UWorld::DuplicateWorldForPIE(NonPrefixedLevelName, PersistentWorld);
if (PIELevelWorld)
{
	PIELevelWorld->PersistentLevel->bAlreadyMovedActors = true; // As we have duplicated the world, the actors will already have been transformed
	check(PendingUnloadLevel == NULL);
	SetLoadedLevel(PIELevelWorld->PersistentLevel);

	// Broadcast level loaded event to blueprints
	OnLevelLoaded.Broadcast();

	return true;
}

```

This is inside `ULevelStreaming::RequestLevel`. I’m not really sure what the comment means, but the level is definitely the new level being streamed in (why it is called the PersistentLevel I’m not sure, it isn’t the persistent level - just a duplication of the persistent world…).

Also, the fact that it is talking about PIE (PlayInEditor) makes me worry this is going to be an editor only issue…

How do I correctly apply the transform to the level?

**Update**

Commenting out the setting of `bAlreadyMovedActors` in the above sample does “resolve” the issue, so it is at least related to that.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_afd92cec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_afd92cec](https://forums.unrealengine.com/u/anonymous_user_afd92cec)\
**Post date:** [June 16, 2015, 12:05pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/2 "2015-06-16T12:05:11Z")

</div>

Yeah, it’s a known issue, basically setting level transform in the blueprints does not work in PIE. Editor assumes that loaded sub-levels are already been transformed, so he does not need to apply transformation again when duplicating sub-levels for PIE session. We will look into fixing it, as a workaround you can PIE as standalone game, in this case blueprint transformations will work, because game will actually load sub-levels instead of duplicating them from editor world.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2db7ca80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2db7ca80](https://forums.unrealengine.com/u/anonymous_user_2db7ca80)\
**Post date:** [June 16, 2015, 12:34pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/3 "2015-06-16T12:34:50Z")

</div>

Ah ok, what down sides are there to commenting out the `bAlreadyMovedActors` in the above sample? Didn’t see any issues but obviously didn’t test exhaustively. Would rather not use the standalone if possible…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_afd92cec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_afd92cec](https://forums.unrealengine.com/u/anonymous_user_afd92cec)\
**Post date:** [June 16, 2015, 12:46pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/4 "2015-06-16T12:46:16Z")

</div>

It will not work correctly when you have transform applied in the Editor. In Levels details tab you can set sub-level transform. But if you don’t use editor transforms then ignoring bAlreadyMovedActors will work fine.

---

<div class="post-metadata">

**Author:** ![YeHaike](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@YeHaike](https://forums.unrealengine.com/u/YeHaike)\
**Post date:** [January 30, 2018, 5:10pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/5 "2018-01-30T17:10:09Z")

</div>

Holp this can help you: [https://youtu.be/hLIs0Bou7mU](https://youtu.be/hLIs0Bou7mU)

---

<div class="post-metadata">

**Author:** ![joessu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joessu](https://forums.unrealengine.com/u/joessu)\
**Post date:** [February 19, 2019, 5:01am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/6 "2019-02-19T05:01:48Z")

</div>

This is still an issue in 4.21. I think i would like to also ignore bAlreadyMovedActors but would hate to have to fork the engine just for this. Any plans to address this issue?

---

<div class="post-metadata">

**Author:** ![vbs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vbs](https://forums.unrealengine.com/u/vbs)\
**Post date:** [March 7, 2019, 3:53pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/7 "2019-03-07T15:53:28Z")

</div>

Why can’t we have this exposed as a boolean option in editor for each sub-level and if we tick it off (to enable dynamic transforms) then the editor transform box becomes disabled to show that it is being ignored…

---

<div class="post-metadata">

**Author:** ![jamarlo11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jamarlo11](https://forums.unrealengine.com/u/jamarlo11)\
**Post date:** [July 25, 2023, 7:03pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/8 "2023-07-25T19:03:46Z")

</div>

can it be that this problem is still not resolved in 5.2? At least I still have it. Any known fixes yet?

---

<div class="post-metadata">

**Author:** ![Smiker](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Smiker](https://forums.unrealengine.com/u/Smiker)\
**Post date:** [February 2, 2024, 11:42am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/9 "2024-02-02T11:42:13Z")

</div>

After a morning of struggling with this, I think I have a solution.

I make the solution in C++, this is the code:

```auto
void ACorridorActor::LoadLevel(const FName LevelName, const FTransform& LevelTransform)
{
	auto CurrentLevel = UGameplayStatics::GetStreamingLevel(GetWorld(), LevelName);

	if (CurrentLevel && !CurrentLevel->IsLevelLoaded())
	{
		LoadedLevelTransform = LevelTransform;
		LoadedLevelName = LevelName;
		
		FLatentActionInfo LatentInfo;
		LatentInfo.Linkage = 0;
		LatentInfo.UUID = 1;
		LatentInfo.CallbackTarget = this;
		LatentInfo.ExecutionFunction = "CallbackOnLevelLoaded";
		UGameplayStatics::LoadStreamLevel(this, LevelName, false, false, LatentInfo);
	}
	else if (CurrentLevel == nullptr)
	{
		UE_LOG(LogTemp, Error, TEXT("ERROR: Could not load level %s, level not found!"), *LevelName.ToString());
	}
}

void ACorridorActor::CallbackOnLevelLoaded()
{
	auto CurrentLevel = UGameplayStatics::GetStreamingLevel(GetWorld(), LoadedLevelName);

	if (CurrentLevel)
	{
#if WITH_EDITOR
		FLevelUtils::SetEditorTransform(CurrentLevel, LoadedLevelTransform);
#endif
		CurrentLevel->LevelTransform = LoadedLevelTransform;
		CurrentLevel->SetShouldBeVisible(true);

		OnLevelLoaded.Broadcast();
	}
}

void ACorridorActor::UnloadLevel(FName LevelName)
{
	const auto CurrentLevel = UGameplayStatics::GetStreamingLevel(GetWorld(), LevelName);

	if (CurrentLevel && CurrentLevel->IsLevelLoaded())
	{
		FLatentActionInfo LatentInfo;
		LatentInfo.Linkage = 0;
		LatentInfo.UUID = 0;
		LatentInfo.CallbackTarget = this;
		LatentInfo.ExecutionFunction = "CallbackOnLevelUnloaded";
		UGameplayStatics::UnloadStreamLevel(this, LevelName, LatentInfo, false);
	}
}

void ACorridorActor::CallbackOnLevelUnloaded()
{
#if WITH_EDITOR
	auto CurrentLevel = UGameplayStatics::GetStreamingLevel(GetWorld(), LoadedLevelName);

	if (CurrentLevel && !CurrentLevel->IsLevelLoaded())
	{
		// To avoid warnings in the editor, should be moved to Identity at this point. 
		FLevelUtils::SetEditorTransform(CurrentLevel, FTransform());
	}
#endif
	
	OnLevelUnloaded.Broadcast();
}

```

Tested inside and outside the editor.

Hope this helps someone.

---

<div class="post-metadata">

**Author:** ![rocifier](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rocifier](https://forums.unrealengine.com/u/rocifier)\
**Post date:** [December 6, 2024, 8:48am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/10 "2024-12-06T08:48:45Z")

</div>

Just use Load Level Instance by Name. It takes a Location parameter (and rotation) and you can load the same level more than once. It works in PIE and standalone/packaged.

---

<div class="post-metadata">

**Author:** ![Levitikon217](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Levitikon217](https://forums.unrealengine.com/u/Levitikon217)\
**Post date:** [January 25, 2025, 1:07am UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/11 "2025-01-25T01:07:38Z")

</div>

This works great!! It’s really nice to be able to set the level transform without having to run in standalone mode.

---

<div class="post-metadata">

**Author:** ![Levitikon217](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Levitikon217](https://forums.unrealengine.com/u/Levitikon217)\
**Post date:** [January 25, 2025, 6:37pm UTC](https://forums.unrealengine.com/t/level-translation-when-streaming-not-working/321991/12 "2025-01-25T18:37:02Z")

</div>

Taking it a step further I created a couple of AsyncActions of these so they can be global BP Nodes. Hope this helps!

This works in PIE and Standalone Game run from Editor.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/7/767c18483726eaf7f5b1f58df860a49d1ccaf0ad.png)

`LoadStreamLevelAsyncAction.h`

```auto
#pragma once

#include "Kismet/BlueprintAsyncActionBase.h"
#include "LoadStreamLevelAsyncAction.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLoadStreamLevel_OutputPin, ULevelStreaming*, level);

UCLASS()
class YOURGAME_API ULoadStreamLevelAsyncAction : public UBlueprintAsyncActionBase
{
    GENERATED_BODY()

    UPROPERTY()
    ULevelStreaming* Level;
    
    UPROPERTY()
    FTransform Transform;
    
public:
    virtual void Activate() override;

    UPROPERTY(BlueprintAssignable)
    FOnLoadStreamLevel_OutputPin OnCompleted;

private:

    UFUNCTION()
    void LatentActionCallback();

public:
    UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "worldContextObject", AllowedClasses = "World", DisplayName = "Load Stream Level"), Category = "Trifecta|Level|Stream")
    static ULoadStreamLevelAsyncAction* LoadStreamLevel(UObject* worldContextObject, const TSoftObjectPtr<UWorld>& _level, const FTransform& _transform);
};

```

`LoadStreamLevelAsyncAction.cpp`

```auto
#include "Level/LoadStreamLevelAsyncAction.h"
#include "LevelUtils.h"
#include "Engine/LevelStreaming.h"
#include "Engine/World.h"
#include "Kismet/GameplayStatics.h"
#include "Misc/PackageName.h"

void ULoadStreamLevelAsyncAction::Activate()
{
    if (Level && !Level->IsLevelLoaded())
    {
        FLatentActionInfo latentActionInfo;
        latentActionInfo.CallbackTarget = this;
        latentActionInfo.ExecutionFunction = FName("LatentActionCallback");
        latentActionInfo.UUID = 0;
        latentActionInfo.Linkage = 0;
        
        UGameplayStatics::LoadStreamLevel(this, Level->PackageNameToLoad, false, false, latentActionInfo);
    }
    else if (Level == nullptr)
    {
        UE_LOG(LogTemp, Error, TEXT("ERROR: Could not load level %s, level not found!"), *Level->PackageNameToLoad.ToString());
    }    
}

void ULoadStreamLevelAsyncAction::LatentActionCallback()
{
    if (Level)
    {
#if WITH_EDITOR
        if (GIsEditor) // Also don't run when Standalone Game from the editor  
            FLevelUtils::SetEditorTransform(Level, Transform);
#endif

        Level->LevelTransform = Transform;
        Level->SetShouldBeVisible(true);

        OnCompleted.Broadcast(Level);
    }    
}

ULoadStreamLevelAsyncAction* ULoadStreamLevelAsyncAction::LoadStreamLevel(UObject* worldContextObject, const TSoftObjectPtr<UWorld>& level, const FTransform& transform)
{
    ULoadStreamLevelAsyncAction* asyncAction = NewObject<ULoadStreamLevelAsyncAction>(worldContextObject);
    
    asyncAction->Level = UGameplayStatics::GetStreamingLevel(worldContextObject->GetWorld(), FName(*FPackageName::ObjectPathToPackageName(level.ToString())));
    asyncAction->Transform = transform;

    return asyncAction;
}

```

`UnloadStreamLevelAsyncAction.h`

```auto
#pragma once

#include "Kismet/BlueprintAsyncActionBase.h"
#include "UnloadStreamLevelAsyncAction.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnUnloadStreamLevel_OutputPin, ULevelStreaming*, level);

UCLASS()
class YOURGAME_API UUnloadStreamLevelAsyncAction : public UBlueprintAsyncActionBase
{
    GENERATED_BODY()

    UPROPERTY()
    ULevelStreaming* Level;
    
public:
    virtual void Activate() override;

    UPROPERTY(BlueprintAssignable)
    FOnUnloadStreamLevel_OutputPin OnCompleted;

private:

    UFUNCTION()
    void LatentActionCallback();

public:
    UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "worldContextObject", AllowedClasses = "World", DisplayName = "Unload Stream Level"), Category = "Trifecta|Level|Stream")
    static UUnloadStreamLevelAsyncAction* UnloadStreamLevel(UObject* worldContextObject, const TSoftObjectPtr<UWorld>& _level);
};

```

`UnloadStreamLevelAsyncAction.cpp`

```auto
#include "Level/UnloadStreamLevelAsyncAction.h"
#include "LevelUtils.h"
#include "Engine/LevelStreaming.h"
#include "Engine/World.h"
#include "Kismet/GameplayStatics.h"
#include "Misc/PackageName.h"

void UUnloadStreamLevelAsyncAction::Activate()
{
    if (Level && !Level->IsLevelLoaded())
    {
        FLatentActionInfo latentActionInfo;
        latentActionInfo.CallbackTarget = this;
        latentActionInfo.ExecutionFunction = FName("LatentActionCallback");
        latentActionInfo.UUID = 0;
        latentActionInfo.Linkage = 0;
        
        UGameplayStatics::UnloadStreamLevel(this, Level->PackageNameToLoad, latentActionInfo, false);
    }
    else if (Level == nullptr)
    {
        UE_LOG(LogTemp, Error, TEXT("ERROR: Could not load level %s, level not found!"), *Level->PackageNameToLoad.ToString());
    }    
}

void UUnloadStreamLevelAsyncAction::LatentActionCallback()
{
#if WITH_EDITOR
    if (Level && !Level->IsLevelLoaded())
    {
        // To avoid warnings in the editor, should be moved to Identity at this point. 
        FLevelUtils::SetEditorTransform(Level, FTransform());
    }
#endif

    OnCompleted.Broadcast(Level);
}

UUnloadStreamLevelAsyncAction* UUnloadStreamLevelAsyncAction::UnloadStreamLevel(UObject* worldContextObject, const TSoftObjectPtr<UWorld>& level)
{
    UUnloadStreamLevelAsyncAction* asyncAction = NewObject<UUnloadStreamLevelAsyncAction>(worldContextObject);
    
    asyncAction->Level = UGameplayStatics::GetStreamingLevel(worldContextObject->GetWorld(), FName(*FPackageName::ObjectPathToPackageName(level.ToString())));

    return asyncAction;
}

```
