docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ConvertToNestedPrefab

    Class for converting an exported FBX to a Prefab Variant.

    Inheritance
    object
    ConvertToNestedPrefab
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Formats.Fbx.Exporter
    Assembly: Unity.Formats.Fbx.Editor.dll
    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.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)