David Jefferies
Topic Author
Posts: 27
Joined: 14 Jan 2021, 17:09

Textures sometimes fail to load in Unreal

28 Sep 2023, 17:01

In Unreal we've moved the loading of the Xaml files from disk to be asynchronous. This is because we want to be able to load/unload them during gameplay - the motivation here is that unloading the Xaml means its textures get unloaded as well.

We initiate the async load like this:
StreamableManager.RequestAsyncLoad(XamlObject.ToSoftObjectPath(),	FStreamableDelegate::CreateRaw(this, &FViewLoader::OnXamlLoaded),
									FStreamableManager::AsyncLoadHighPriority, false, false, "ViewLoader");

Then when its loaded we call LoadXaml on it
void FViewLoader::OnXamlLoaded()
{
	UNoesisXaml* XamlFile = XamlObject.Get();
	const Ptr<BaseComponent> Component = XamlFile->LoadXaml();
	..
}
The issue we're having is sometimes the textures for the Xaml fail to load with the error message:
LogNoesis: Warning: Error loading '/Game;component/MyGame/Images/image_8.png', using fallback texture
Stepping through the code we can see that CreateTexture is failing because InTexture->GetResource() returns nullptr
Noesis::Ptr<Noesis::Texture> FNoesisRenderDevice::CreateTexture(UTexture* InTexture)
{
	if (!InTexture || !InTexture->GetResource())
		return nullptr;
..
}
The issue only occurs in a standalone build - never in editor - and seems to be timing related, sometimes it works fine sometimes it fails.

It looks like the textures haven't finished loading when CreateTexture tries to access them - the UTexture object exists but texture data doesn't yet

Any ideas what we can do to resolve it?
 
User avatar
hcpizzi
Site Admin
Posts: 321
Joined: 09 Feb 2012, 12:40

Re: Textures sometimes fail to load in Unreal

29 Sep 2023, 14:49

Hi David,

I've created a ticket to keep track of this issue. Here's a link: https://www.noesisengine.com/bugs/view.php?id=2705

Please, monitor the ticket, and I will post there as soon as I figure out how to resolve this.

Thanks
 
David Jefferies
Topic Author
Posts: 27
Joined: 14 Jan 2021, 17:09

Re: Textures sometimes fail to load in Unreal

29 Sep 2023, 16:16

Great - thanks :)

One point that may be relevant is that the textures that are being loaded when it fails are quite large - 2560 x 1440 x 24bit
 
David Jefferies
Topic Author
Posts: 27
Joined: 14 Jan 2021, 17:09

Re: Textures sometimes fail to load in Unreal

10 Oct 2023, 16:38

I'd like to query the severity as 'minor' because the issue means we can't load Xamls asynchronously.

This is a problem because textures are only unloaded when all the references to the UNoesisXaml object are released. So to unload the textures we need to unload the Xaml file but then if we want to show the element again we're forced to load it synchronously, causing hitches.

We either need to be able to load the Xamls asynchronously, or be able to release the textures without unloading the Xaml
 
User avatar
jsantos
Site Admin
Posts: 3925
Joined: 20 Jan 2012, 17:18
Contact:

Re: Textures sometimes fail to load in Unreal

10 Oct 2023, 19:11

Thanks, severity changed to "major"
 
User avatar
hcpizzi
Site Admin
Posts: 321
Joined: 09 Feb 2012, 12:40

Re: Textures sometimes fail to load in Unreal

18 Oct 2023, 13:12

Hi David,

I've added a comment to the ticket (to keep the conversation in a single place). Could you please take a look?

Thanks!

Who is online

Users browsing this forum: No registered users and 5 guests