# I'm trying to load level streaming in another thread

**URL:** <https://forums.unrealengine.com/t/im-trying-to-load-level-streaming-in-another-thread/619163>\
**Category:** C++\
**Tags:** unreal-engine, Code, UE4, question, UE4-27\
**Created:** [August 1, 2022, 4:53pm UTC](https://forums.unrealengine.com/t/im-trying-to-load-level-streaming-in-another-thread/619163 "2022-08-01T16:53:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnthonyDerossi00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnthonyDerossi00](https://forums.unrealengine.com/u/AnthonyDerossi00)\
**Post date:** [August 1, 2022, 4:53pm UTC](https://forums.unrealengine.com/t/im-trying-to-load-level-streaming-in-another-thread/619163/1 "2022-08-01T16:53:12Z")

</div>

Hi guys, I’m trying to load a stream level not in the main thread.  
We have big levels and we want to decrease the loading time for console, so I thought I’d be a good idea to load the rest of levels in a secondary thread.  
I’m using a C++ class that inherits from FNonAbandonableTask, but I’m struggling when I type the LoadStreamLevel function because I can’t access to the GetWorld function, I can’t select a WorldContext, so I can’t stream the level… Any help? ☹

```auto
class AStreamLevelLoaderTask : public FNonAbandonableTask
{
public:
	AStreamLevelLoaderTask(FName _levelToLoad);
	~AStreamLevelLoaderTask();
	void DoWork();
	
	// required by UE4, is required
	FORCEINLINE TStatId GetStatId() const
	{
		RETURN_QUICK_DECLARE_CYCLE_STAT(LoadLevelTask, STATGROUP_ThreadPoolAsyncTasks);
	}
protected:
	FName LevelToLoad;

```

```auto
AStreamLevelLoaderTask::AStreamLevelLoaderTask(FName _levelToLoad)
{
	
}

AStreamLevelLoaderTask::~AStreamLevelLoaderTask()
{
	this->Abandon();
}

void AStreamLevelLoaderTask::DoWork()
{
	// The place where the main action
}

```
