Unity Editor
DigitalHeaven.Unity.Editor is a Unity Editor plugin that imports compiled .pallet files into native Unity assets — materials, textures, meshes, and prefabs. It provides an editor window for building and watching pallets, a PalletSource asset for configuring imports, and an extensibility system for game-specific pipeline hooks.
Ships alongside DigitalHeaven.Unity as pre-compiled DLLs. No source compilation required.
Editor Window
Section titled “Editor Window”Open via Window → DigitalHeaven in the Unity menu bar.
| Control | Description |
|---|---|
| Build | Runs dh build then imports all pallets |
| Import Only | Imports existing compiled pallets without rebuilding |
| Start/Stop Watching | Toggles auto-rebuild on source file changes |
The window shows a thin progress bar at the top during builds, a status light (green when watching, grey when idle), and the last build’s result (time, asset count, errors, warnings). Below the controls is a list of all PalletSource assets in the project with buttons to select each one.
Pallet Source
Section titled “Pallet Source”A PalletSource is a ScriptableObject that tells the import pipeline which pallet to import and where to put the results.
Create one via Assets → Create → DigitalHeaven → Pallet Source.
| Field | Description |
|---|---|
| Path Mode | Relative (output relative to this asset’s folder) or Absolute (subfolder under Assets/) |
| Path | Subfolder appended to the base path. Leave empty for the base path itself |
| Append Pallet Name | Add the pallet ID as a subdirectory (default: on for Absolute mode) |
| Pallet ID | Which compiled pallet to import |
| Available Pallets | Dropdown populated from .pallet files in the workspace build directory, with a refresh button |
| Output Path | Read-only preview of the resolved output directory |
| Dependencies | Other PalletSource assets this pallet depends on (for cross-pallet references) |
The dependencies section validates entries against the compiled pallet’s manifest. Matched dependencies show a green “OK” indicator; entries not in the manifest show a warning. Missing manifest dependencies are flagged at the bottom of the section.
The inspector also has Build and Import Only buttons scoped to that specific pallet, and an Open DigitalHeaven Window shortcut.
Hash Store
Section titled “Hash Store”Each PalletSource auto-creates a companion PalletHashStore asset (a sibling .hash.asset file). This maps CRC32 checksums and pallet paths to Unity asset references, enabling two-stage asset tracking: path match first, then hash match. Assets are moved and updated in-place when possible, preserving Unity GUIDs across rebuilds so scene references don’t break.
The inspector shows the number of tracked assets in the hash store.
Import Pipeline
Section titled “Import Pipeline”When you build or import, the pipeline runs these phases in order:
- Textures — write texture files to disk (batched with
AssetDatabase.StartAssetEditing) - Materials — write non-inheriting material files (same batch)
- Refresh & apply settings —
AssetDatabase.Refresh(), then set texture filter/wrap modes and wire up deferred material textures - Inherited materials — copy base materials and apply child overrides
- Models — parse GLBs into Mesh assets + Prefabs
- Prefabs — create prefabs from
.dh-obj/.dh-avatardefinitions, applying all patch types - Inherited prefabs — create Unity Prefab Variants via
PrefabUtility - Extension post-processing — fire
OnAfterImporthooks, then save and update the hash store
Dependencies are imported in topological order — if pallet A depends on pallet B, B is imported first.
Output Structure
Section titled “Output Structure”DirectoryAssets/
Directoryyour-output-path/
Directoryio.example.my-avatar/ Pallet ID (if Append Pallet Name is on)
Directorytextures/
- body-diffuse.png
- body-normal.png
Directorymaterials/
- skin.mat Unity materials
Directorymodels/
- body.asset Mesh data
- body.prefab Model prefab
- avatar.prefab Final assembled avatar
Supported Patches
Section titled “Supported Patches”The PrefabImporter handles all patch types from dh.object:
dh.import-model, dh.import-object, dh.set-material, dh.set-blendshape, dh.set-transform, dh.set-parent, dh.set-rig, dh.armature-link, dh.set-spring-bones, dh.remove-object
Material Pipeline
Section titled “Material Pipeline”The MaterialImporter creates Unity Material assets from dh.material definitions. It maps semantic properties to the correct shader for the active rendering pipeline (Built-in, URP, HDRP) — the same mapping documented on the Unity runtime page. Platform overrides at platforms/unity/ are applied after the base material.
Extensibility
Section titled “Extensibility”Game-specific Unity integrations (VRChat, ChilloutVR, etc.) can hook into the import pipeline via IEditorPipelineExtension:
| Hook | When |
|---|---|
OnBeforeImport | Before any assets are created |
OnTextureCreated | After each texture is written |
OnMaterialCreated | After each material is created |
OnPrefabCreated | After each prefab is assembled (on the live scene instance, before save) |
OnAfterImport | After all assets are imported |
GetPlatformOverridePaths | Returns additional platform override search paths |
ReadPlatformMetadata | Reads game-specific metadata from pallets |
Register extensions via [InitializeOnLoad] with EditorPipelineExtensionRegistry. Extensions are sorted by Priority (lower = earlier). All methods have default no-op implementations — extensions only override what they need.
Deployment
Section titled “Deployment”The editor DLL deploys to Assets/Plugins/DigitalHeaven/Editor/ — the Editor/ subfolder ensures Unity only loads it in the editor, not in builds.
The build system’s DeployToUnityProjects target in Directory.Build.targets automatically copies editor DLLs to the Editor subfolder. Game-specific editor extensions (like VRChat) are deployed to the same location.
Development
Section titled “Development”The project is at DigitalHeaven.Unity.Editor/ in the repository.
| Target framework | netstandard2.1 |
| C# version | 13.0 (PolySharp) |
| Dependencies | DigitalHeaven.Core, DigitalHeaven.Unity |
| Unity references | UnityEditor.CoreModule, UnityEngine.CoreModule, UnityEngine.ImageConversionModule, UnityEngine.AnimationModule, UnityEngine.IMGUIModule, UnityEngine.TextRenderingModule |
Unity editor stub DLLs are sourced from ExternalLibs/Unity.Editor/ — a local-only, git-ignored directory populated from your Unity 6 Editor installation.