PathProcessor
Pre-processor that translates asset paths from a package's original structure to the project's target structure using ProcessorTable mappings. Also detects GUID conflicts, asset changes, and determines which items should be imported.
Definition
Namespace: Paragon.Editor.ThirdPartyPackageImporter Assembly: Paragon.Editor.dll
internal class PathProcessor : ProcessorInherits: Processor
Remarks
This is the most complex processor in the pipeline. It transforms the import manifest by translating paths, detecting whether assets already exist, and deciding what should be imported or skipped.
Path Translation
The TryGetTranslatedPath method translates paths using a two-level lookup:
Exact match — checks the full path against the
ProcessorTable(all contexts)Directory + file match — if no exact match:
Splits the path into directory and file name
Looks up the directory in
DIRECTORIEScontextLooks up the file name (without extension) in
FILEScontextReassembles the translated path
All paths are normalized to Unix-style separators (/) before lookup.
Asset Existence Detection
IsAssetExists checks two sources:
AssetDatabase.GUIDToAssetPath— finds assets by GUID (handles moved files)Direct path check — falls back to checking the destination path
Change Detection
IsAssetChanged determines if an asset needs reimporting:
GUID conflict
Different GUID at the destination path → always changed
Folder
Never considered changed
File size
Compare FileInfo.Length — different = changed
File content
Optional byte-by-byte comparison (8 bytes at a time) — enabled by CheckFileContentForAssetChanges
enabledStatus Decision Tree
Path not translatable
0
Skip (no mapping in table)
Asset doesn't exist
1
Import (new asset)
Asset exists, changed
1
Import (update)
Asset exists, unchanged
0
Skip (no changes)
Quick Lookup
Map a directory
Add entry in ProcessorTable under DIRECTORIES context
Map a file name
Add entry in ProcessorTable under FILES context
Set target path variable
Add $PATH$ entry in VARIABLES context
Force reimport all
Set AllowReimportUnchangedAssets = true
Enable content comparison
Set CheckFileContentForAssetChanges = true
Fields
ImportFoldersWithChangedGuids
bool
public
When true, re-imports folders whose GUID has changed
CheckFileContentForAssetChanges
bool
public
When true, performs byte-by-byte content comparison for change detection
AllowReimportUnchangedAssets
bool
public
When true, enables all existing assets for reimport regardless of changes
packagePath
string
private
The resolved $PATH$ variable from the ProcessorTable
Methods
OnProcess (protected override)
Resolves the $PATH$ variable and returns all non-project assets from the package.
OnProcessItem (protected override)
Translates the item's path, checks existence, detects conflicts and changes, and sets enabledStatus.
TryGetTranslatedPath (private)
Attempts to translate a path using the ProcessorTable. Tries exact match first, then directory + file name match.
IsAssetChanged (private)
Compares an existing asset with the source to determine if it has changed. Uses file size comparison, with optional byte-level content comparison.
Common Pitfalls
$PATH$ variable must be set The processor asserts that the $PATH$ variable exists in the VARIABLES context of the ProcessorTable. If missing, a Debug.Assert will fire.
Untranslatable paths are silently disabled Items whose paths cannot be translated (no matching entry in the ProcessorTable) have enabledStatus set to 0 and are silently skipped. There is no warning logged for unmapped paths.
Content comparison can be slow When CheckFileContentForAssetChanges is true, the processor reads both the existing and source files byte-by-byte (8 bytes at a time). For large assets, this can significantly slow down the pre-processing phase.
Path separator normalization Paths are normalized to Unix-style (/) before lookup. ProcessorTable entries should use forward slashes to match correctly.
See Also
PreProcessors Overview — pre-processor subsystem
PrepareProcessor — visibility filtering (runs after PathProcessor)
ProcessorTable — lookup table for path mappings
Last updated