Asset Import
All assets are represented by documents. That means to get a texture into the engine, you need a texture document which describes which source files (png, jpg, etc) are used to create the texture and how they shall be imported. This is where you configure such things as, whether to use compression, whether an alpha channel should be present and so on.
Other asset types of course have other options for importing.
To create these documents you have two options: Manual or automatic import.
Create Documents Manually
You can manually create documents via Editor > Create Document.... In the file creation dialog, choose the file extension for the desired asset type and specify where to store the document. The newly created document will be in a blank state. You will need to fill out all the properties, including where the source files are located.
This method always works for all asset types and for some types it is the only way. Since this method always involves multiple, mostly simple steps, it can become tedious. Therefore, some asset types provide a way to automate much of this process.
Create Documents Automatically
For asset types that are mostly defined by a single source file (e.g. textures and meshes), the editor often provides an importing method that automates most of the trivial setup.
Select Editor > Import Assets... or press CTRL+I to open a file browse dialog. Navigate to the file(s) that you want to import and select them. If you want to know which asset types are currently supported for automatic import, you can open the dropdown with the allowed file extensions here. Dragging and dropping an asset will skip the browser dialog.
After you selected the source files, you will be presented with a table of options how to import them.
Here we selected four files for import. One .obj file and three .jpg files. The automatic import uses heuristics to make an educated guess how to import certain source files. Here it already suggests to import the "_col.jpg" file as a diffuse texture, the "_nrm.jpg" file as a normal map and so on. If the heuristic is incorrect, you can use the dropdown on the left to fix it.
It also suggests the target document file name. You can either click Browse or double click into the text field to change the target file name.
Some source files can be imported in multiple ways. For example the .obj file could be imported as a mesh for rendering or as a mesh for physics. Often you want to import the same mesh for both, so you want two asset documents (a Mesh and a Collision Mesh) which reference the same input file. Therefore this table lists the .obj file twice but with different import options in the dropdown box. If, for example, you do not want a mesh to be imported as collision mesh, at all, you can just select No Import from the respective dropdown.
Once you click Import the asset documents are generated and you can then open them. If background asset processing is enabled, the editor will already start transforming the asset data. Otherwise open each document and click the button of a white box with the green arrow to manually trigger the asset transform.
The automatic import creates the documents using a set of rules to fill out its properties, depending on the template that you selected for it. So for example an image imported as a "diffuse texture" and one imported as a "normal map" are mostly the same, except that a few options are already configured in a certain way for you. You should review all options for correctness afterwards.
If the folder has import rules, the dialog shows which rule applies to each file (for example Character Albedo (rule: Characters/.plImportRules #1)) and pre-selects the rule's method and preset. Drag and drop and Import As use the rules as well.
Every asset created this way remembers how it was imported: the method, the preset and the rule. Hover over the asset in the asset browser to see it, for example Imported with Character Albedo.
Import Presets
An import preset (.plImportPreset, in the Utilities category) is a named set of import settings that you can apply to many assets, for example Character Albedo for a texture or Static Prop for a mesh. A preset only sets the values it lists. Everything else keeps its default, or for a reimport, its current value.
| Property | Description |
|---|---|
| Based On | Another preset whose values this one inherits. Its own values override the base's. |
| Method | The import method, for example Diffuse Texture or Normal Map. Empty: the editor's guess, or the base preset's method. |
| Target Type | The asset properties type the preset is for, for example plTextureAssetProperties. Empty: any. |
| Values | A list of Property and Value pairs, as text. Enumerations are given by name. Mesh import options are given as Options.<name>: Options.CreateMaterials, Options.UseSharedMaterials, Options.SharedMaterialsFolder, Options.ReuseSkeleton, Options.Skeleton, Options.ImportAnimationClips, Options.AddLODs, Options.NumLODs, Options.SplitByNode, Options.SplitBySubMesh and Options.CreatePrefab. When a preset sets any of them, the mesh options dialog is skipped. |
The easiest way to make a preset is from an asset you have already set up: right-click it in the asset browser and choose Save as Preset.... The preset gets every value of the asset that differs from the defaults, its target type and the method it was imported with, and opens so you can remove the values that should not be part of it.
Applying a preset is one undo step. A value for a property that the asset type no longer has, for example because a package renamed it, is logged and skipped instead of failing the import.
Import Rules
Import rules decide how files in a folder are imported, so that everyone on a team imports them the same way. Right-click a folder in the asset browser and choose Import Rules....
The dialog shows the rules inherited from the folders above, and a table of this folder's own rules:
| Column | Description |
|---|---|
| Patterns | File name patterns separated by ;, with * and ? wildcards, for example *_n.png;*_normal.png. Case is ignored. |
| Method | The import method. Empty: the editor's guess, or the preset's method. |
| Preset | The import preset to apply. Optional. |
| New files | What happens when a matching file arrives from outside the editor, for example by a copy or a source control sync: Off (nothing), Ask (the default: offered for import in the Reimport queue tab), or Auto (imported at once, with a log line). |
Add rule, Remove and Move up edit the table, and Test a file name shows which rule a name would match and what it would do, or No rule matches. The generator's guess is used.
For a file, the nearest folder with rules wins, going up from the file's folder to its data directory, and within that folder the first matching rule wins. The rules are stored in the folder as a .plImportRules file, in OpenDDL, so they can be checked in:
ImportRules
{
Rule
{
string %Patterns { "*_n.png;*_normal.png" }
string %Method { "TextureImport.Normal" }
string %Preset { "" }
string %NewFiles { "Ask" }
}
}
The editor picks up edits to the file, and reports a file that does not parse, with the line, in the log.
Reimporting
When a source file changes
When a source file of an asset changes on disk, for example because you saved it in your paint or modelling program, the editor reimports the assets that use it. It waits until the file has been quiet for a moment and is readable, so it never reads a half-written file. An asset that is open with unsaved changes is held and never overwritten; it is reimported once you save or close the document.
The Reimport queue tab of the Asset Curator shows this work, and the curator status adds · N reimporting while it runs. The Reimport Settle Time and Reimport Foreground Budget preferences tune it.
Reimporting on purpose
Right-click assets and choose Reimport..., or right-click a folder and choose Reimport Folder... (the folder and its sub-folders). Pick one of three modes:
| Mode | What it does |
|---|---|
| Reimport from source | Keeps every setting and transforms the assets again from their source files. |
| Reapply recorded preset | Writes the fields of the preset each asset was imported with again, for example after the preset changed. |
| Switch to preset | Writes the fields of another preset (by name, path or GUID) and records it as the asset's preset. |
The dialog lists every asset with its Recorded preset and its Plan (Ready, Skipped or Declined), and shows the changes per asset before anything is written. A preset only overwrites the fields it sets, so changes you made by hand to other fields are kept. Assets that are open with unsaved changes, or are read-only, are declined.
Reimport applies all ready rows or none: if one asset can't be written, the assets already changed are restored. The applied assets then go through the reimport queue.