Asset references
An asset column names a Unity asset instead of holding a value. SheetForge has three asset cell types, and each one takes an optional <Type> restriction.
Cell types and delivery modes
A workbook is one settings asset, with the source and the output folder that asset names. Its delivery mode decides how baked databases reach the game.
The workbook's delivery mode gates which asset cell types its columns may use.
| Cell type | The cell holds | Allowed in |
|---|---|---|
AssetRef@Group | An Addressables address in the group | The Addressables mode only |
ResourceRef | A path below a Resources folder | The Resources and scene catalogue modes |
DirectRef | A project path or a GUID | Every mode |
The mode is the workbook's, so two workbooks in one project may differ.
A column that breaks the rule is one AssetCellTypeNotAllowedInDeliveryMode error at its @type cell. The error names the mode and the types it does accept.
The sheet is never rewritten. The Data Studio's type list still offers the type, with the reason beneath it, because the sheet stays the source of truth. See Types the delivery mode refuses.
Restrict a column to an asset type
AssetRef@Icons accepts any address in the group. AssetRef@Icons<Sprite> narrows it to one asset type. The full notation is AssetRef@Group<Type>.
The narrowing is checked at three points: validation, code generation and the Data Studio.
Type names
The type is any asset type derived from UnityEngine.Object that the project can load. Engine types and your own ScriptableObjects both qualify. There is no allow-list.
Engine types include Sprite, Texture2D, AudioClip, and an abstract base such as Texture. Components and editor-only types are not candidates.
Write the short name when exactly one type carries it, or when exactly one of the types that carry it is concrete. Otherwise, write the full name, including the namespace.
| Name | Error code | The report includes |
|---|---|---|
| Ambiguous | AmbiguousAssetType | Every candidate |
| Unknown | UnknownAssetType | A nearest-match suggestion |
Both errors are reported once per column, on the @type row.
Types in predefined assemblies
A type that the generated code cannot reference is refused. A type that lives in a predefined assembly is found but reported as AssetTypeNotReferenceable.
The predefined assemblies are Assembly-CSharp and its siblings. That covers any script folder without an assembly definition.
The generated companion assembly cannot reference those assemblies, so AssetReferenceT<T> would not compile.
To fix the error, move the type into a folder covered by an assembly definition, or drop the <…>.
What passes the restriction
An address satisfies the restriction when the asset at that address, or any of its sub-assets, is loadable as that type.
| Asset at the address | Result for <Sprite> |
|---|---|
| A texture imported in Sprite mode | Passes |
| A plain texture | Reported per cell as AssetTypeMismatch |
The sub-asset itself is addressable as parent[sub]. That address is checked against the sub-asset's own type only.
Generated code
| Column | Codegen emits |
|---|---|
| Restricted to a resolved type | AssetReferenceT<global::UnityEngine.Sprite> |
| Unrestricted | AssetReference |
The companion assembly definition automatically references the assembly the type lives in.
The resolved full name is part of the schema fingerprint, so re-mapping the name regenerates the code.
Composition
A restricted reference composes like any other type.
| Notation | Result |
|---|---|
AssetRef@Icons<Sprite>? | Works |
List<AssetRef@Icons<Sprite>> | Works |
Pair<AssetRef@Icons<Sprite>> | Works. The outer type is a wrapper |
AssetRef@Icons<> | Syntax error. The restriction is empty |
AssetRef@Ic<ons | Syntax error. An angle bracket is in the group name |
RecordId@Skills<X> | Syntax error. The restriction is for the three asset cell types only |
The Type… button
In the Data Studio, right-click the column's header and choose Edit column properties…. The form that opens has a Type… button beside the Type (@type) field.
The button lists the candidate types and rewrites the @type cell for you. See Restrict an asset column to a type.
References without Addressables
Two asset cell types need no Addressables catalog: ResourceRef<Type> and DirectRef<Type>.
Both identify their asset on their own, so neither takes an @group. Writing one is TypeTokenGroupNotAllowed, with the notation minus the group as the suggestion.
Both take the same optional <Type> restriction that AssetRef takes, resolved by the same rules. The short name works under the same conditions, and the full name always works. Predefined-assembly types are not accepted.
Both compose the same way: ResourceRef<Sprite>?, List<DirectRef<Sprite>>, Pair<ResourceRef<Sprite>>.
ResourceRef cells
A ResourceRef<Sprite> cell holds the path of an asset relative to its Resources folder, without the extension. An example is Icons/gear_helm. A sub-asset is path[name].
| Pasted project path | Result |
|---|---|
Under a Resources folder, such as Assets/Art/Resources/Icons/gear_helm.png | Converted to the relative form |
Under no Resources folder | ResourcePathOutsideResources |
The import checks two things.
| Check | When it fails |
|---|---|
The path exists under some Resources folder | UnknownResourcePath, with the nearest existing path suggested |
| The asset loads as the restricted type | AssetTypeMismatch |
A path that two Resources folders both offer is a DuplicateResourcePath warning. The value is intact. Only which asset loads is decided by scan order.
Codegen emits SheetForge.Runtime.ResourceRef<Sprite>. It is a serializable struct with Path, SubName, IsEmpty, Load() and LoadAsync(). An unrestricted column emits ResourceRef<UnityEngine.Object>.
DirectRef cells
A DirectRef<Sprite> cell holds the asset's project path, such as Assets/Art/badge.png, or its 32-digit GUID. Both are always read, and a cell keeps whichever spelling it has.
Anything else is DirectRefPathMustStartWithAssets. A sub-asset is path[name] or guid[name].
The import checks that the path or GUID names an asset of this project.
| Failure | Error code | Suggestion |
|---|---|---|
| Unknown path | UnknownAssetPath | The nearest path |
| Unknown GUID | UnknownAssetGuid | None, since no GUID is "near" another |
The import also checks that the asset loads as the restricted type. A failure is AssetTypeMismatch.
Codegen emits the asset itself: a Sprite field, or UnityEngine.Object when unrestricted. The field is resolved at bake time, so the asset is loaded together with the database.
Canonical spellings
These rules decide how a path or a GUID is spelled in a cell.
| Value | Canonical spelling |
|---|---|
ResourceRef path | Keeps its letter case, folds \ to /, and takes the path after the innermost Resources folder |
DirectRef path | Keeps its extension and case |
DirectRef GUID | Written lower-case |
A ResourceRef path keeps its letter case because the engine's lookup is case sensitive.
Export writes the spelling the cell already had. The DirectRef cells as GUIDs setting only decides how a newly filled cell is written. The setting is on the settings asset, as DirectRef cells as GUIDs describes.
Sub-assets
In a ResourceRef or DirectRef cell, a sub-asset is written parent[name], with one exception. The name is left out when all four of these conditions hold:
- The column carries a resolved
<Type>. - The main asset is not of that type.
- Exactly one object inside the main asset is of that type.
- That object bears the file's own name. The name is the file name without its extension, and the comparison is case sensitive.
A texture sliced into a single sprite is written Badges/badge_rare, not Badges/badge_rare[badge_rare]. A texture holding several sprites keeps [name], and so does an unrestricted column.
A single rule decides the exception. The Data Studio's drop and picker share it with the writer behind Export and Push. Because the Data Studio and the writer apply the same rule, a round trip never respells a cell.
An AssetRef cell does not use the exception. It follows the Addressables convention unchanged, so its sub-asset is always written parent[sub].
Broken references on screen
The Data Studio marks the cell itself. A ResourceRef or DirectRef whose value stops resolving is underlined on the cell, with the diagnostic as its tooltip. Causes include an unknown path, a moved asset and a type mismatch.
The diagnostic comes from the same list the Problems panel shows. When an asset is imported, moved or deleted outside the window, the grid is drawn again after a moment.
The web app reads both cell types and checks neither. It has no project to check paths or GUIDs against, so existence and the delivery mode's cell-type check are the editor import's job. The web app marks its cells the same way for the diagnostics it can produce. See Project assets.
Limits
Sub-assets load synchronously
A ResourceRef naming a sub-asset can only be loaded synchronously. LoadAsync() returns an already finished handle.
A path does not follow a moved asset
A DirectRef written as a path stops resolving when the asset moves. The next import says so and suggests the nearest path. A GUID follows the asset.
Next steps
- Asset and visual cells
Pick, drop and preview assets in the Data Studio.
- Choose a delivery mode
Compare the modes that gate the asset cell types.
- Types and defaults
The rest of the type system, including optional columns and lists.
- Type and asset limits
What typed references and sub-assets cannot do.