Download

Delete all unused assets

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…

It seems like this solution is the best so far ( tried the command suggested and it deleted about 30mb while this one deleted more than 1gb )

I didn’t test it thoroughly but it seems like it is working fine.

Just need to keep in mind to make the new project with the exact same name as the old one in order to have Cpp code work ( my project is using blueprints that inherits from Cpp and from plugin’s Cpp )

So what I did basically is:

1.copy the plugins, source and config folders to the new project.
2.Migrate the levels from the old projects to the new one’s content.
3.Generate project files and build in visual studio

And that’s it.

+1 for one click button for “migrating unused assets out” (aka Delete)

or

Show All Unused Assets in Maps

The “Show Unused Assets” is pretty much the only option for this to work since these automatic detections can and will have false-positives.

So what I did basically is:

1.copy the plugins, source and config folders to the new project.
2.Migrate the levels from the old projects to the new one’s content.
3.Generate project files and build in visual studio

And that’s it.

THIS WORKED PERFECTLY FOR ME. GREAT SOLUTION TO GET RID OF UNUSED ITEMS BEFORE BUILDING THE FINAL EXE.