Class ConvertToNestedPrefab
Class for converting an exported FBX to a Prefab Variant.
Namespace: UnityEditor.Formats.Fbx.Exporter
Syntax
public static class ConvertToNestedPrefab
Methods
ConvertToPrefabVariant(GameObject, String, String, String, String, ConvertToPrefabVariantOptions)
Convert one object (and the hierarchy below it) to a prefab variant of a model prefab.
Returns the prefab asset that's linked to the fbx.
If 'toConvert' is:
- A GameObject in the Scene, then the method exports the hierarchy to an FBX and creates a new Prefab Variant pointing to the exported FBX.
- The root of an FBX asset, or the root of an instance of an FBX asset, then the method creates a new Prefab Variant pointing to the existing FBX.
- A Prefab asset, then the method exports a new FBX asset and creates a new Prefab Variant pointing to the FBX.
Declaration
public static GameObject ConvertToPrefabVariant(GameObject toConvert, string fbxDirectoryFullPath = null, string fbxFullPath = null, string prefabDirectoryFullPath = null, string prefabFullPath = null, ConvertToPrefabVariantOptions convertOptions = null)
Parameters
Type | Name | Description |
---|---|---|
GameObject | toConvert | Object to convert. |
String | fbxDirectoryFullPath | Absolute platform-specific path to a directory in which to put the fbx file under a unique filename. May be null, in which case we use the export settings. Ignored if 'fbxFullPath' is specified. Ignored if 'toConvert' is an fbx asset or an instance of one. |
String | fbxFullPath | Absolute platform-specific path to the fbx file. If the file already exists, it will be overwritten. May be null, in which case we construct a unique filename. Ignored if 'toConvert' is an fbx asset or is an instance of one. |
String | prefabDirectoryFullPath | Absolute platform-specific path to a directory in which to put the prefab file under a unique filename. May be null, in which case we use the export settings. Ignored if 'prefabFullPath' is specified. Ignored if 'toConvert' is a prefab asset. |
String | prefabFullPath | Absolute platform-specific path to the prefab file. If the file already exists, it will be overwritten. May be null, in which case we construct a unique filename. Ignored if 'toConvert' is a prefab asset. |
ConvertToPrefabVariantOptions | convertOptions | Export options to use for exporting the model asset to convert to a Prefab. |
Returns
Type | Description |
---|---|
GameObject | The prefab variant linked to an fbx file. |