ThirdPartyPackageUtility
Static utility class that downloads catalog and processor table data from Google Sheets, manages local disk caching, and provides file enumeration helpers for the third-party package system.
Definition
Namespace: Paragon.Editor.ThirdPartyPackageImporter Assembly: Paragon.Editor.dll
internal static class ThirdPartyPackageUtilityRemarks
ThirdPartyPackageUtility is the I/O backbone of the third-party package system. It handles:
Remote data download — Fetches CSV data from a Google Sheets spreadsheet using
UnityWebRequestLocal caching — Stores downloaded data in
Application.persistentDataPath/Third-Party Packages/Deserialization — Parses CSV text into typed objects (
ThirdPartyPackageCatalogandProcessorTable)File enumeration — Lists file and directory names in a folder, filtering out
.metafiles
Google Sheets Integration
The catalog and processor tables are stored as sheets in a single Google Sheets document. Each sheet is exported as CSV using the URL pattern:
https://docs.google.com/spreadsheets/d/{document_id}/export?gid={sheet_id}&format=csvSheet GID 0 — The main catalog (one row per package)
Sheet GID {CatalogID} — Per-package processor table (rename/remap rules)
Caching Strategy
CSV Format — Catalog
The first row is a header (skipped). ImportFolder values have "Assets" replaced with "Assets/Third-Party" during deserialization.
CSV Format — ProcessorTable
Context headers start with $ and have empty values. Variables are expanded into DIRECTORIES and FILES contexts.
Quick Lookup
Download fresh catalog
var catalog = await ThirdPartyPackageUtility.DownloadCatalog()
Load cached catalog
var catalog = ThirdPartyPackageUtility.LoadCatalog()
Load processor table for package
var table = await ThirdPartyPackageUtility.LoadProcessorTable(packageID)
List files in a folder
ThirdPartyPackageUtility.GetAllFileNamesInFolder(path)
Get the Google Sheets URL
ThirdPartyPackageUtility.GetDocumentUrl()
Fields
google_sheets_url
const string
Base URL: "https://docs.google.com/spreadsheets/d"
export_url
const string
Export format string: "{0}/export?gid={1}&format=csv"
document_id
const string
The Google Sheets document ID (hardcoded)
documentUrl
static readonly string
Full document URL (constructed at static init)
cacheFolder
static readonly string
Application.persistentDataPath/Third-Party Packages/
filteredExtensions
static readonly string[]
Extensions to exclude from file enumeration ([".meta"])
Methods
DownloadCatalog
Downloads the catalog sheet (GID 0) from Google Sheets, caches it to disk, and returns the deserialized catalog.
LoadCatalog
Loads the catalog from the local disk cache. Returns null if no cache file exists.
LoadProcessorTable
Downloads or loads a cached processor table for a specific package. Automatically cleans up stale cache files (same CatalogID, different Hash). Registers the table with ThirdPartyPackageProcessor.
packageID
int
Asset Store ProductID — used to look up the package's CatalogID and Hash
GetAllFileNamesInFolder
Returns all file names (without extension) and relative directory paths in the given folder, excluding .meta files. Returns empty if the path doesn't exist.
path
string
Absolute path to the folder to enumerate
GetDocumentUrl
Returns the full Google Sheets document URL.
Common Pitfalls
DeserializeCatalog returns null on error If CSV parsing fails (malformed data, network issues), DeserializeCatalog catches the exception, logs it via Debug.LogException, and returns null. Callers should handle a null catalog gracefully.
ImportFolder path rewriting During catalog deserialization, importFolder values are transformed: "Assets" is replaced with Path.Combine("Assets", "Third-Party"). This means the CSV should contain paths like "Assets/PolygonFantasy" which become "Assets/Third-Party/PolygonFantasy".
LoadProcessorTable requires ThirdPartyPackageManager LoadProcessorTable calls ThirdPartyPackageManager.GetPackage(packageID) to resolve the CatalogID and Hash. The manager must be initialized before loading processor tables.
Cache cleanup deletes files by pattern LoadProcessorTable deletes all files matching {CatalogID}_* except the current hash. If other files happen to match this pattern in the cache folder, they will be deleted.
Google Sheets document ID is hardcoded The document_id constant is baked into the source. Changing the catalog spreadsheet requires a code change and recompilation.
See Also
ThirdPartyPackageManager — calls DownloadCatalog and LoadCatalog
ThirdPartyPackageCatalog — the deserialized catalog type
ThirdPartyPackageProcessor — consumes registered ProcessorTables
ThirdPartyPackageManager Overview — system overview
Last updated