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 : Processor

Inherits: 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:

  1. Exact match — checks the full path against the ProcessorTable (all contexts)

  2. Directory + file match — if no exact match:

    • Splits the path into directory and file name

    • Looks up the directory in DIRECTORIES context

    • Looks up the file name (without extension) in FILES context

    • Reassembles the translated path

All paths are normalized to Unix-style separators (/) before lookup.

Asset Existence Detection

IsAssetExists checks two sources:

  1. AssetDatabase.GUIDToAssetPath — finds assets by GUID (handles moved files)

  2. Direct path check — falls back to checking the destination path

Change Detection

IsAssetChanged determines if an asset needs reimporting:

Check
Method

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

Condition
enabledStatus
Meaning

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

Goal
How

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

Field
Type
Access
Description

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

circle-exclamation
circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated