# (Auto) asset import breaks after opening an asynchronously loaded level

**URL:** <https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179>\
**Category:** Pipeline & Plugins\
**Tags:** content-browser, unreal-engine, bug-report, editor, UE4, question\
**Created:** [December 11, 2015, 4:25pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179 "2015-12-11T16:25:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrDean](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrDean](https://forums.unrealengine.com/u/MrDean)\
**Post date:** [December 11, 2015, 4:25pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/1 "2015-12-11T16:25:36Z")

</div>

We have encountered a problem where asset importing stopped working in certain situations. This happens with both automatic and manual reimporting.

It can be reproduced was as follows:

- Open a big level through the Content Browser. (I think the reason that it should be a big level is that the level is loaded asynchronously when opened)
- Navigate to a texture in the content browser that is referenced by one of the Actors in the level that was just opened.
- Right-click on that texture and choose “Reimport”
- Observe that a file selection window opens instead of the expected behaviour where the import is started.

A debug session showed that the SourceData variable in UAssetImportData for the broken assets wasn’t set. This value is supposed to be set in the UAssetImportData::Serialize function. However, this function is not always being called.

Some more investigation showed that the reason Serialize is not called is that the RF\_NeedLoad flag is is not set on the UAssetImportData object.

It was observed that the AssetImportData was loaded properly when it was used in a small level. The reason for the different behaviour is a branch in FLinkerLoad::CreateExport. Somewhere in the middle of the function there is the following piece of code:

```

if(FPlatformProperties::RequiresCookedData() 
	|| IsAsyncLoading()
	|| Export.bForcedExport
	|| LinkerRoot->ShouldFindExportsInMemoryFirst()
	)

```

Here we see a branch that is entered when AsyncLoading is enabled.  
In this branch the RF\_NeedLoad flag is only being set under certain conditions:

```

if (!Export.Object->HasAnyFlags(RF_LoadCompleted) &&
(Export.Object->HasAnyFlags(RF_DefaultSubObject) || (ThisParent && ThisParent->HasAnyFlags(RF_ClassDefaultObject))))
{
	Export.Object->SetFlags(RF_NeedLoad | RF_NeedPostLoad | RF_NeedPostLoadSubobjects | RF_WasLoaded);
}

```

At this point the only flag set on the UAssetImportData object is RF\_Async.

In UTexture::PostInitProperties it can indeed be observed that the UAssetImportData is constructed without any flags.

At this point I am not sure how to properly solve the problem. I am pretty certain the RF\_NeedLoad flag needs to be set on the UAssetImportData objects somehow. But I don’t understand the system well enough to decide how that should be achieved.

So, my question would be if someone is familiar with this system and can help me fix it, tell me if I’m looking in the right direction, or is this maybe a known issue that is already being worked on?

---

<div class="post-metadata">

**Author:** ![Lovecraft\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lovecraft\_K](https://forums.unrealengine.com/u/Lovecraft_K)\
**Post date:** [December 11, 2015, 7:15pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/2 "2015-12-11T19:15:49Z")

</div>

Hi MrDean -

I am looking into this issue now and will respond back here if I have any questions or can provide you with an answer.

Thank You

Eric Ketchum

---

<div class="post-metadata">

**Author:** ![MrDean](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrDean](https://forums.unrealengine.com/u/MrDean)\
**Post date:** [December 11, 2015, 9:13pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/3 "2015-12-11T21:13:49Z")

</div>

Nice to hear, thanks!

---

<div class="post-metadata">

**Author:** ![Lovecraft\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lovecraft\_K](https://forums.unrealengine.com/u/Lovecraft_K)\
**Post date:** [December 14, 2015, 3:17pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/4 "2015-12-14T15:17:33Z")

</div>

Hello -

I have been trying a few different internal maps including the kite demo and I am not able to get the results that you are describing above unless the source location is no longer valid for the texture asset. Do you have a sample project which demonstrates this issue that I could test? You can attach it here or link it to me via the following private message system:

[https://forums.unrealengine.com/private.php?do=newpm&u=4892](https://forums.unrealengine.com/private.php?do=newpm)

Thank You

Eric Ketchum

---

<div class="post-metadata">

**Author:** ![MrDean](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrDean](https://forums.unrealengine.com/u/MrDean)\
**Post date:** [December 15, 2015, 10:06am UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/5 "2015-12-15T10:06:54Z")

</div>

I sent you a message.

---

<div class="post-metadata">

**Author:** ![Lovecraft\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lovecraft\_K](https://forums.unrealengine.com/u/Lovecraft_K)\
**Post date:** [December 15, 2015, 3:40pm UTC](https://forums.unrealengine.com/t/auto-asset-import-breaks-after-opening-an-asynchronously-loaded-level/341179/6 "2015-12-15T15:40:46Z")

</div>

Hi Mr.Dean -

Thank You for your help, I was able to reproduce the issue and entered the report as UE-24505. As we continue to investigate a solution I will keep you informed here.

Eric Ketchum
