Delete all unused assets

I’d change this into a show unused assets. There might be some stuff you’re not using yet but plan to do so in the near future.

+1, cleaning up is not easy. Any feature that could help here would be very useful for a lot of people at all stages of a project


Already time consuming enough to double check if old reference files and empty folders are deleted. And if you want to make this sophisticated add an option to search for double assets.

+1 for this, but with a minor change. Would it be possible to fix the content browser finally? Since long time when i move a folder into an another its still not moved and i have to delete the files manually + do “fix up object redirectors in folder”. And its really a pain

Oh yes, +1.

Thanks for the feedback, votes and +1’s y’all! I’ve put this into a request and am getting into the right people’s hands. Please let us know if there are any other specifics of how you would like this to function so I can have it in the report.

+1 for this

Could it be really just a command that you can perform in the editor. Right click on the content browser and have a CleanUp unreferenced assets that provides a list of assets that will be deleted and unselect assets that you want to skip. Finally you could confirm and it would perform a cleanup and delete every asset that is not used.

UE4 has WrangleContentCommandlet which should remove all unused assets, it is undocumented feature and may not work very well.
It can be launched this way:

UE4Editor.exe "Myproject\MyProject.uproject" -run=WrangleContent -allmaps

It may take some additional parameters to setup it’s behavior:

// overall commandlet control options
bool bShouldRestoreFromPreviousRun = FParse::Param(*Params, TEXT("restore"));
bool bShouldSavePackages = !FParse::Param(*Params, TEXT("nosave"));
bool bShouldSaveUnreferencedContent = !FParse::Param(*Params, TEXT("nosaveunreferenced"));
bool bShouldDumpUnreferencedContent = FParse::Param(*Params, TEXT("reportunreferenced"));
bool bShouldCleanOldDirectories = !FParse::Param(*Params, TEXT("noclean"));
bool bShouldSkipMissingClasses = FParse::Param(*Params, TEXT("skipMissingClasses"));

// what per-object stripping to perform
bool bShouldStripLargeEditorData = FParse::Param(*Params, TEXT("striplargeeditordata"));
bool bShouldStripMips = FParse::Param(*Params, TEXT("stripmips"));

// package loading options
bool bShouldLoadAllMaps = FParse::Param(*Params, TEXT("allmaps"));

// if no platforms specified, keep them all
UE_LOG(LogContentCommandlet, Warning, TEXT("Keeping platform-specific data for ALL platforms"));

FString SectionStr;
FParse::Value( *Params, TEXT( "SECTION=" ), SectionStr );

Whenever I tried this command, it never did anything.

UE4Editor-Cmd.exe "Myproject\MyProject.uproject" -run=WrangleContent -allmaps

Try using “UE4Editor-Cmd.exe” instead of “UE4Editor.exe”.

+1 for this “Delete all unused assets”

+1 for “mark all unused assets” or better “show/filter all unused assets”. Or … simply make it possible to blend a little number to asset icons, which show how often the asset is used in maps. Would also be nice. And when it is “0” you know it is not used already. But a filter would be nice too, for fast search all unused assets and delete it.

This would be great---- until you go looking for something you deleted. I sometimes make a new project because of my clutter, and migrate certain things to restructure, and re organize.

You can manually set which maps are included in build settings.
Unused assets and maps that aren’t in the list then won’t be added to packaging.

Very good idea.

This is a different issue. People may want to clean up their project just to make it easier to work with, or they want to hand it off to other and not have that unused content. It’s not all about the final build.

But in that case then “migrating” the wanted MAP files to another project is already a cleanup.
I’d rather creating a fresh project for migration than delete existing files; for many little reasons deletion of files can break a project.

I Just tried the WrngleContent commandlett and it worked just fine. It was on a very simple project so I can’t verify if it works on more complex or C++ projects tho.

"C:\Program Files\Epic Games\UE_4.18\Engine\Binaries\Win64\UE4Editor-Cmd.exe" "D:\Perforce\Epic\depot\usr\Tom.Shannon\GameJamKit - Copy\GameJamKit.uproject" -run=WrangleContent -allmaps

Wow both are very nice information… tq…