UE5 Crash on building streaming texture

look like happening on only one map on my project.

But only since migration to UE5

I found a reason to the crash and a workaround

Reason:
I was using some assets from the Old Brick House pack and I .gitignore thirdparty packs. I copy used assets to my project folder so I only version the used assets to reduce git size. I’ve found that 2 assets were using materials still in the pack folder and deleting them from the map made the Build go without crash. I downloaded again the pack and replaced the old folder with the new but the crash would still happens if the assets were points to the pack, so I found a work around and a theory.

Workaround:
Re-Download (or not) and copy/paste used assets from pack folders including any material or texture into a new folder.

Theory:
Maybe the pack that isn’t 5.0 ready need to be rebuilded by the owner and copy/pasting the assets converts them to 5.0 ready.

3 Likes

Thanks for this help !

I had the same issue. It seems the issue is with some project textures sharing the same guid. I have no idea how Unreal expects users to track down the problematic textures, but I found a way to fix it via running a bit of code.

Simply run this code somewhere in the editor:

TMap<FGuid, UTexture*> guids;

for (TObjectIterator<UTexture> it; it; ++it)
{
	if (!it->GetLightingGuid().IsValid())
	{
		continue;
	}
	
	UTexture** result = guids.Find(it->GetLightingGuid());
	if (result == nullptr)
	{
		guids.Add(it->GetLightingGuid(), *it);
	}
	else
	{
		UE_LOG(LogTemp, Warning, TEXT("%s: Texture has had its Guid updated."), *it->GetName());
		it->SetLightingGuid();
		it->Modify();
	}
}

FText DialogText = FText::FromString("Done, save all to save all");
FMessageDialog::Open(EAppMsgType::Ok, DialogText);

It’s a modified bit of code from a plugin that does something similar for Materials.

I’ll have a plugin up in a few hours that uses this code to fix the issue.

6 Likes

Great work!

1 Like

Here’s the fix I mentioned a bit cleaned up in a plugin format!

The plugin also includes a fix for conflicting material GUIDs, which is something I ran into in an earlier version.

8 Likes

Thank you for the effort!
Your plugin fixed a texture and a material in my project, unfortunately that did not fix my crash on building streaming textures.

I will try this, if it work, you are an absolute master.

1 Like

Working like a charm, thanks a lot !
@Majusbear are you sure you use save all before building ? what is the error code ?

1 Like

As @Aherys said, make sure you save all first, and make sure the error you get when building includes Assertion failed: StreamingTextures.Num() == StreamingTextureGuids.Num(), otherwise it’s likely a different error.

If it is that error, try running the plugin, saving all, and restarting the editor. Run the plugin again and let me know if it still is saying it’s changing ids. If so that likely means it’s trying to change the GUID of something it can’t edit. If that’s the case, please let me know, and I should be able to make an edit to the plugin to account for that.

Also, if possible, open up the output log after running the plugin and let me know the name of the textures that it reports have changed.

1 Like

Thank you for the detailed response! I will come back to you on monday, when I can test this.

Your plugin fixed in my project the crash on building streaming textures thank for your work.

1 Like

First of all, unfortunately it still won’t work for me.
I can confirm that I have the “correct” error (copy & pasted from the crash message: Assertion failed: StreamingTextures.Num() == StreamingTextureGuids.Num() ).
When I try to use the plugin again it just tells me “No duplicate texture/material GUIDs found.”

I dug a bit in the logs to find the materials/textures that the plugin did change the first time I tried it, which where the following:
https://pastebin.com/iUeQfZv7

You may be running low on VRAM is my best guess?

Does it tell you “No duplicate texture GUIDs found.” even after restarting the editor and running it again?

Yes, it does.

I tried to find the problematic assets inside the map, by deleting a bunch of assets at a time and rerunning the Build streaming textures until it worked, but I couldn’t pin point the problem. It did build after I deleted a whole bunch of assets but after I recovered the original map and only deleted the last chunk of assets I deleted the last time around it still didn’t work.

I think the issue tends to stem from duplicating textures in a way Unreal doesn’t handle well, so multiple textures end up with the same GUID. I’m not too sure why it would be giving you an error of duplicate texture GUIDs when all your textures are still reporting unique GUIDs.

  • My first idea would be that my program updated a GUID it couldn’t, so it thought there’s no conflict even though there is. In that case, I would expect the GUID to revert on an editor restart, so I don’t see that as too likely.

    • To address this, I could change my plugin to update the GUID of all textures with a matching GUID, rather than letting the first texture retain its GUID. However, to do this, you’d need to reset the textures to a state before my plugin previously updated them, so the program could know which ones to update.
  • My second idea I have is that my plugin doesn’t update the GUID of textures that have an empty GUID. The reason I have it this way is that otherwise, the plugin ends up trying to update a bunch of engine textures, but I haven’t had any actual issues when the plugin includes textures with empty GUIDs.

    • A simple change to the plugin should allow you to hit any textures that don’t have a GUID, although this will also result in the plugin always telling you that a texture has changed, since it will always attempt to fix the engine plugins (at least each time you restart the editor).
  • My last remaining idea would be that TObjectIterator (what my plugin uses to find all the textures) “does not include any class default objects.” Maybe if the problematic texture is an improperly copied version of whatever Unreal is considering to be a “class default object,” that could cause the issue? I’m not really sure.

    • With a bit more work, I could probably figure out how to get all class default textures, but I’m not too sure how to do that offhand. I’d assume they’d have an empty GUID anyways, so I’d assume the second solution fixes it. Otherwise, if you’d duplicated a “class default object” multiple times, solution one would also be enough.

I’ve made a version of my plugin on a new branch that has the fix for the first and second idea. It also includes the full path name of updated textures, which should help make debugging a tad easier.

EDIT: Plugin is now available for free on the Unreal Marketplace!

5 Likes

Wow! You are absolutely awesome! The newest version of your plugin fixed my errors!
Thank you so much, I really appreciate you going the extra mile in helping out.

If you are interested in which GUIDs where updated this time around, here is the relevant part of the log.

1 Like

Assuming the log messages are accurate, it seems only engine textures were updated (outside of the media texture in the scripts folder, which purportedly changes every time). I’m very surprised that did the trick, as I didn’t think engine textures could cause any issues.

Very glad it ended up fixing your issues though! I’m a bit busy with other projects (I’ve had to downgrade from this version of Unreal due to other bugs), but when I get a chance, I’ll add a third button in the master branch that includes textures with empty GUIDs.

How do you install this plugin i’m really new to this, I’ve made a folder in the project folder called plugin but when I try to load unreal it says that its missing a module from a different version and closes it down ?

Kind regards