USD Export: Prefab as Payload support
Unity’s Prefab packages 3D model as an asset. By placing this Prefab in the scene and performing a USD export, one Prefab is output to one USD file.
In the case of this billiard table, the 3D model with the blue icon in the Hierarchy is the Prefab.
![Unity's Prefab.](../../_images/unity_prefab_01.jpg)
Instructions for exporting Unity Prefab as a USD Payload
In the main menu, select [Omniverse]-[Settings] and turn on the “Prefab to Payload” checkbox before exporting the USD.
![Prefab to Payload.](../../_images/unity_prefab_PrefabToPayload.png)
Prefab assets are output to the “payloads” folder.
!["payloads" folder.](../../_images/unity_prefab_02.png)
In the case of a nested Prefab, a folder corresponding to the Prefab hierarchy is created.
In the following case, the “Props” asset is exported as ”Props.usd”, which has a structure with several prefabs.
![Structure of USD when using Payload.](../../_images/unity_prefab_04.jpg)
USD files exported to USD are assigned an external reference as Payload.
Also, materials are held separately for each USD exported as a Prefab.
In the “Materials” folder, a folder is created with the name of the material in which the texture files are stored.
![Outputting textures for use in materials.](../../_images/unity_prefab_07.png)
Override in Prefab
This “billiard_table” prefab has no material assigned to it.
After placing the “billiard_table” in the scene, we assigned a material to Prefab.
![Override in Prefab.](../../_images/unity_prefab_03.jpg)
This operation is called an “override”.
The structure of this Prefab override is the same role as the USD Reference/Payload override.
In the following case, the material is overridden and assigned to the mesh of the Payload prim.
![Payload override in USD Composer.](../../_images/unity_prefab_05.jpg)
The following elements can be overridden.
Transform of GameObject
Visibility of GameObject
Binding of GameObject materials
Physics parameters of GameObject
Note
The following are NOT available in a Prefab: Moving between hierarchies within a Prefab and Delete GameObject in Prefab.
Unity’s Prefab allows you to rename child GameObjects placed in the scene.
However, the USD file does not allow renaming of Prims that are children of Reference/Payload.
USD Stage Hierarchy output from a Prefab
The USD output of a Prefab will have the following USD Stage Prim structure.
![USD Stage Hierarchy output from a Prefab.](../../_images/unity_prefab_06.jpg)
The prim path starts with “/World/[Prefab name]/Geometry”.
[Prefab name] is the prefab name in Unity and is the same string as the USD file name.
Note
This is the current specification and is subject to change in the future.
Live Sync
Live Sync exports all of the scene’s USD files once before use.
By checking the “Prefab as Payload” checkbox in Settings, the prefab will be exported as a separate USD file.
The root USD file will be externally referenced as Payload.
During Live Sync, the Payload meshes will update the operation as an override.
Also, if you add a new asset to the scene, this will be added to the root USD.
Note
The new asset Prefab is not output to another USD file.