Find Reference is a robust tool designed to efficiently track all references among assets within a project. With this tool, users can precisely identify which assets are included in scenes, eliminate redundant assets from each scene, detect duplicated assets, and swiftly replace prefabs, materials, textures, and shaders with just a few clicks. These are just some of the features offered by Find Reference.
- Full C# source code is provided.
- It boasts blazing-fast performance.
- Compatible with Unity versions 5.x, 2017.x, 2018.x, 2019.x, 2020.x and 2021.x
- Overview
- UPM Package
- Features
- Getting Started
- Usage Count
- Uses
- Used By
- Merge & Replace Duplicated Assets
- GUID Tools
- Unused Assets
- Select Dependencies and Custom Export Package
- Temporarily Disable Find Reference
- Manual Refresh
- FAQ - How can Find Reference help reduce build size?
- FAQ - How can Find Reference help restructuring and modularize projects?
Requires a version of unity that supports path query parameter for git packages (Unity versions 5.x, 2017.x, 2018.x, 2019.x, 2020.x and 2021.x). You can add https://github.com/Long18/FindReference.git
to Package Manager
- Usage count in project panel
- Select an asset in the Project Panel to immediately view:
- Its dependencies (assets being used by the selected ones - tab Use)
- Where it’s being used (both by Game Objects in opening scenes & by other Assets - tab Used By)
- Select a GameObject in the Hierarchy view to view:
- Its dependencies (both assets and Scene Game Objects)
- Which Game Objects in the opening scenes are using it.
- Find all duplicated assets inside this project
- Merge all duplicate assets into one (replace references)
- Replace usage for multiple assets
- Find all assets that are not referenced by any other assets
- Powerful mark and commit selection feature
- Lock selection
- With extensive search, sort, and filter support
- GUID tools
- Install the package
- Wait for the script compilation to complete, ensuring there are no compiler errors
- Open Find Reference panel from Windows > Find Reference
Note: Alternatively, you can press Alt + F to open the tool.
After Find Reference completes scanning the project, it will display the frequency with which an asset is utilized by other assets on the left side. This feature facilitates a quick assessment of how frequently an asset is employed or whether it remains unused.
The Uses
feature enables listing the dependencies of selected assets.
In the default grouping mode, dependencies are separated into assets based on their relationship to the selected asset. The following modes are available:
- Direct Usage: Assets referenced directly by assets in the selection.
- Indirect Usage: Assets referenced by assets in the
Direct Usage
category.
The Uses
feature extends beyond assets; it also applies when selecting scene objects or prefabs. All assets used or referenced by the selected GameObject are displayed.
The "Used By" feature allows you to find all assets that have a reference to a selected asset.
In the default grouping mode, dependencies are separated into assets based on their relationship to the selected asset. The following modes are available:
- Selection: Assets directly selected.
- Direct Usage: Assets that are referenced directly by assets in the selection.
- Indirect Usage: Assets that are referenced by assets in the
Direct Usage
category.
To merge and replace duplicated assets, you need to click on Scan
to initiate the scanning process. The scanning process is fast, so there's no need to worry. Once scanned, you'll have the option to combine all usages into a single asset and then remove the other unused ones. However, it's crucial to back up everything before proceeding, as this action is irreversible.
While the idea of merging and replacing assets may sound risky, once you become familiar with the Replace Usage
function, you'll find it indispensable. It's an incredibly powerful tool for any project, regardless of its age!
Note: This function (Merge & replace) is currently under maintenance. Please check back later for updates.
The GUID Tools feature allows you to select an object to retrieve its GUID or vice versa. Additionally, it includes a merge GUID function.
Merge GUID Function: Exercise caution when using this function as it is powerful but potentially dangerous. There is no type-checking and no undo option, so only proceed if you fully understand its internal workings and the potential risks involved.
If you find yourself in a situation where you don't need to search for references between assets or Scene Objects, you can temporarily disable Find Reference
. This stops the tool from running and monitoring file changes, conserving resources.
Note: Disabling Find Reference
does not clear the cache, so there's no need to worry about losing any data.
The Find Reference
feature automatically refreshes when assets change. However, there are cases where Unity Asset Importer malfunctions, causing the callbacks relied upon by Find Reference
to not trigger. If you observe that Find Reference
does not display the usage count in front of assets or the icon of the selected asset is not showing, it's likely that a manual refresh is needed.
Performing a manual refresh is safe and quick. If you're unsure, you can manually refresh by clicking on the top-right corner of the Find Reference
window and selecting Refresh
.
-
Removing Unwanted Assets from Scenes:
- Find Reference lists all models, prefabs, materials, textures, shaders, and scripts used in the selected scene.
- You can group assets by type or extension to identify unwanted ones accidentally included in the scene.
- Select unwanted assets to see which component in the scene references them and remove the connection if needed.
- Excluded assets have no references in the scene and are thus excluded from the build.
-
Removing Placeholder Assets in Final Build:
- During editing, some assets might be used for convenience but not wanted in the final build.
- Use Find Reference to select the scene and view all assets used.
- Select placeholder assets not desired in the final build and move them to a specific folder.
- Delete this folder before building and restore it afterward to maintain both easy editing and a small build size.
-
Removing Duplicated Assets in AssetBundles:
- Assets used by multiple AssetBundles are duplicated and included in each bundle.
- Find Reference shows how many times an asset is used and by which assets.
- Assign a new AssetBundle tag to assets used by multiple bundles to prevent duplication.
- Optimizes AssetBundle size by avoiding duplicate assets.
Cleaning up asset references not only reduces build size but also simplifies scene and prefab complexity, resulting in faster load times.
- Identify Assets Used in Scenes or Prefabs:
- Select a scene or prefab, and Find Reference displays all assets used by it.
- Group assets by type and select assets to move.
- Remove shared assets from the selection.
- Create new folders for each asset type and move selected assets to desired folders.
- Repeat until assets are organized as desired.
- Benefits of Organization and Modularization:
- Keep projects organized and modular to facilitate development and maintenance.
- Multiple developers and artists can work on the project simultaneously without conflicts.