How to clean up unused assets from a project in Unreal Engine

The problem of cluttering the project with a bunch of assets is faced by almost every team when the project reaches certain stages. In the project itself, there are assets from prototypes, from purchased packs from the marketplace, as well as just extra junk that, for one reason or another, has become unnecessary. Sooner or later, the project begins to weigh tens of gigabytes, while the working and necessary content remains no more than a couple of gigabytes.

In this article, I wanted to describe how to clean up a project from unused assets without third-party plugins, one of which I recently discovered while optimizing our project. In the end, I’ll also leave a couple of links to third-party plugins so that everything is in one place.

I also warn you in advance that I do not recommend using automatic cleaning tools, including third-party plugins, if the version control system is not configured in the project. Otherwise, you run the risk of irrevocably cleaning up the assets you need without the possibility of recovery.

!!! Please note that all methods use the Unreal Engine’s reference system to determine what will potentially be used in a project and what will not.

If you have assets that are not directly referenced by anything in the editor, but they are somehow loaded implicitly (for example, from code or by soft links), then these assets can be easily removed in one of these ways.

And if you are confident in the safety of your project and are ready to rely on the toolkit, I suggest that you familiarize yourself with the contents of the article.

Method 1 – Filter

This method is the simplest and most effective, although not ideal. Its principle assumes that it simply shows you those assets that are not used in the levels and scenes of your project.

This method will not help to remove assets that are used in any unnecessary scenes, which, for example, got into your project as a result of importing a pack from a store. These scenes will have to be manually deleted before cleaning the project this way.

To filter, you need to select the folder you want to clear of unused assets, and then just enable the filter Not Used In Any Level

Choosing a filter for unused assets
Choosing a filter for unused assets

V Content Browser only those assets will remain that are not used in any scene.

And to show assets from the entire project, you can select the most important folder – Content

After you display all the unused assets, you just have to select the ones you want to delete and click the button Delete

Method 2 – Auditing Assets

Unlike the previous method, this one is a bit tricky, however, it allows you to remove assets used in maps that will not be packed into the final project. It will also help to remove unnecessary scenes.

However, you should be careful with this method, because your project may contain scenes that are not packaged into the project, but are necessary for the development of the project, for example, test scenes or not yet ready-made locations.

To find unused assets in this way, first of all, you should select a folder in Content Browserfrom which we want to find remove unused assets. Then insert a space in the search bar to display all assets, including those in subfolders.

You can also use filters to filter only certain assets.

Show all assets in a folder and subfolders
Show all assets in a folder and subfolders

To determine the use of assets, we need to open the tool Audit Assetsto sort used and unused assets. To do this, you need to select all the assets that were displayed after the previous step, click PKM and select item Audit Assets

Opening an asset audit
Opening an asset audit

A panel will open, where the list contains all the assets that you have selected, as well as various information.

This panel is also useful for determining which assets weigh the most, or which models have the most polygons, for example.

The most important column for the purposes of this article is Total usage, which indicates the likelihood of using the asset in the running project. By sorting the assets by their value, we can get a list of all assets that are not used anywhere (have a value of 0).

To sort the value, you must click on the name of the column itself. If necessary, click again to sort in ascending, not descending order.

Sorting the list by asset usage
Sorting the list by asset usage

By sorting the list by usage, we can select all the assets that we really don’t use and don’t need.

To quickly select all unused ones, you can select the first asset, hold down Shift and select the last unused asset.

At this stage, it is worth making sure that only those assets that are not used are really selected.

When all the necessary assets are selected, we will need to select them in Content Browser‘e. This can be done by clicking on the highlighted list PKM and selecting the item Browse To Asset

Selecting unused assets
Selecting unused assets

The PC may freeze for a while, but after that, in Content Browser only those assets that have been allocated in the asset audit list will be allocated.

Then it will be enough to press Deletehow the engine will start the deletion process.

It will once again show you a list of assets that will be removed, which you can further check. If you are satisfied with the list, you can press the red button Force deletewhich will remove all assets from the list.

Method 3 – Migration

This method is the least preferred, as a second project will be involved in cleaning. The main idea of ​​this method is to select the cards that should remain in the project, and then use the migration tool to transfer the cards and the assets used in them to another project, ignoring all the remaining content.

The main disadvantage of this method is that it does not transfer sources, project configuration, as well as blueprints and data that are not used in maps.

To migrate, you should first create a clean project on the same version of the engine… It is worth immediately transferring all the files necessary for the project to work in a new project. Typically, this is the folder Config and Plugins, and if the project contains sources, then Source and Binaries

In order to migrate maps along with assets, you need to select the necessary assets in the original project, click PKM and select item Migrate

Map migration
Map migration

You should see a window where there will be a list with all the assets that these cards use, and, as a result, what will be transferred to the new project.

Migrate only used assets
Migrate only used assets

After you click OK, the editor will prompt you to choose a path where to transfer maps and assets. You need to select the path to the folder Content in your new project. It is the folder Content, not the path to the project itself, otherwise the migration will not be successful.

Once the migration is complete, you can open a new project and make sure that all the required assets have been migrated and that there are no unused assets.

If some necessary assets have not been migrated, then they can be selected separately and migrated to a new project in the same way.

Method 4 – Plugins

Below is a list of third party plugins that can also help clean up projects. I have never used these plugins and cannot vouch for their work. I decided to drop it here so that the article would be more complete. If you have had experience with one of them, be sure to write about it in the comments.

Conclusion

Perhaps there are some other ways, I just gave those that are known to me. If you have any comments, I will be glad to read them.

I hope the article will be useful for everyone who is constantly cluttering a project with various assets from prototypes, assets from the marketplace, or just versioning.

Similar Posts

Leave a Reply