Delete all unused assets

I have a project that has about 60 gb and most of the assets that is in project are not used in any maps and it’s hard to delete them manually. It also takes a lot of time to do it, while the same I could spend on other more useful activities. Please answer when this function would be available or is there any way to do it manually?

3 Likes

+1 i think its really necessary

3 Likes

+1 I am also for this

2 Likes

It is already inside UE4 Editor, although it is not exactly one button ‘cleanup my assets, please’

  1. Create a new project (this is supposed to be the clean project with all needed asset)
  2. Inside UE4 Editor, working with existing project (which has many unneeded asset), select a level and then right click, Asset Action -> Migrate.
  3. Migrate to the new project just created (select the Content folder).
  4. The migration will copy all referenced asset to the new project
  5. Repeat for all levels.
6 Likes

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.

5 Likes

+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

2 Likes

This.

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.

2 Likes

+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

2 Likes

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.

2 Likes

+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.

4 Likes

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 );

2 Likes

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.