Skip to content
Ashot Barkhudaryan edited this page Jun 14, 2023 · 4 revisions

Welcome to ProjectCleaner Wiki!

IconPjcRaw1920x1080


How to Use?

Click on the Scan Project button to view the assets that have been detected. The results will be displayed in a per-folder tree view with detailed statistics on how many unused assets each folder contains. If you wish, you can exclude certain assets. Next, click on the "Clean Project" button, and it will delete all unused assets and empty folders in the project.

Unused Assets

Before understanding which assets are considered "Unused", we need to define the criteria for an asset being "Used". An asset is considered "Used" if it falls under any of the following categories:

Therefore, any asset that does not satisfy any of the above criteria is considered Unused.

Now lets examine every category in more detail.

Primary

If you are not familiar, with terms Primary or Secondary assets in unreal engine, I recommend you to read this Docs first. Level assets for example are primary by default.

LevelAssets

But you can create or register primary assets by yourself, if you create class inherited from UPrimaryDataAsset and then register it in AssetManager. As an example you can look at ActionRPG project from epics.

AssetManager

Editor

This category of assets includes classes such as EditorTutorial, EditorUtilityBlueprint, EditorUtilityWidget, and similar. These types of assets are not used in Maps, but serve as utilities within the editor.

Screenshot 2023-06-04 010440

Indirect

Sometimes we use assets in source code or config files. For instance, we might use a Material from StarterContent in the source code, loading it programmatically using C++.

Screenshot 2023-06-04 012246

static ConstructorHelpers::FObjectFinder<UMaterial> Material(TEXT("/Game/StarterContent/Materials/M_ColorGrid_LowSpec.M_ColorGrid_LowSpec"));
if (Material.Succeeded())
{
	// using material
}

Now you compiled and everything works perfectly. But what happens if we try to delete that asset from ContentBrowser? Lets see.

Screenshot 2023-06-04 012358

As you can observe, there's no clear indication that this asset is being used in the source code. If we delete it, we will receive a CDO error upon the next editor load.

Another example is asset usage in project configurations.

Screenshot 2023-06-04 011545

All these assets are tracked by the plugin and can be viewed in the Assets Indirect tab.

Screenshot 2023-06-04 013021

As you can see, our material that we used in the source code earlier is detected and will now be marked as a Used asset. For additional information, the file path and line number where the asset is used are also displayed.

ExtReferenced

These are assets that have external references outside the project's Content folder.

Excluded

While the plugin can detect most unused assets, there may be situations where a user might want to exclude certain types of assets from scanning. Fortunately, we have asset exclude settings where you can specify which folders, assets, or asset classes to exclude. Note that the buttons in the toolbar and the buttons in the context menu perform the same actions.

Screenshot 2023-06-04 013832 Screenshot 2023-06-04 013945

If you want to view the excluded assets, you can activate the ProjectCleaner Filters -> Assets Excluded filter in the ContentBrowser.

Screenshot 2023-06-04 014343

Corrupted Assets

There may be situations when not all assets load correctly. While there could be many possible reasons that we can't cover exhaustively, all asset files with engine asset file extensions that are not loaded will be displayed in the Assets Corrupted tab.

Screenshot 2023-06-04 015415

External Files

The plugin also displays files that are not engine asset files but reside in the project's Content folder. Again, you can exclude the files you need and delete the rest. There may be situations where a folder appears empty in the ContentBrowser, but you can't delete it. In such cases, navigate to the Files External tab to view and remove all files you consider unused.

Screenshot 2023-06-04 020016

Blueprints and Python

Most of plugin functionality are exposed via UPjcSubsystem class and can be used in blueprints or python scripts.