integration.md 17 KB

Integrating Unity with 3D modeling software

The Unity Integration tool allows you to effortlessly exchange Assets between Unity and either Autodesk® Maya®, Autodesk® Maya LT™ or Autodesk® 3ds Max®.

Use the Unity Integration tool to import and export FBX files directly to and from Unity without having to specify filenames, select objects, or set FBX importer or exporter settings.

To customize the FBX Importer or Exporter settings in Autodesk® Maya® or Autodesk® Maya LT™, use the unityFbxImportSettings.mel and unityFbxExportSettings.mel files. Both files are located in the Integrations/Autodesk/maya/scripts folder.

For Autodesk® 3ds Max®, use the unityFbxImportSettings.ms and unityFbxExportSettings.ms files located in the Integrations/Autodesk/max/scripts folder.

Installing an Integration

To install Unity Integration for Autodesk® Maya®, Autodesk® Maya LT™, or Autodesk® 3ds Max®, open Fbx Export Settings (menu: Edit > Project Settings > Fbx Export) in Unity:

FBX Export Settings window

Use the 3D Application property to choose the 3D modeling software and version where you want to install the Unity Integration.

To select a version of Autodesk® Maya®, Autodesk® Maya LT™, or Autodesk® 3ds Max® installed outside the default location, click the Browse button.

3D Application property with Browse button (red outline)

Before installing Unity Integration, close all instances of the selected 3D modeling software that matches the specified version.

Click Install Unity Integration to install the Unity Integration for the selected 3D modeling software.

If you already unpacked a previous integration in the selected folder, Unity prompts you to either use the existing integration or to overwrite it with the newer version.

Unity Integration comes packaged in several zip files (one zip file per supported application). When prompted, select a target folder where you want to extract the Unity Integration. The target folder can be outside of your current Project. Autodesk® Maya® and Autodesk® Maya LT™ both use the same zip folder.

The application starts, configures the plug-in, and automatically exits. Unity reports whether the installation was a success.

If an error occurs during startup, Autodesk® Maya® or Autodesk® Maya LT™ may not close. If this happens, check the Autodesk® Maya® or Autodesk® Maya LT™ console to see if you can resolve the issue, and then manually close Autodesk® Maya® or Autodesk® Maya LT™.

If you enabled the Keep Open option in the Fbx Export Settings window, then Autodesk® Maya® or Autodesk® Maya LT™ stays open after installation completes.

Manually Installing an Autodesk® Maya®
or Autodesk® Maya LT™ Integration

In some cases, you have to install your integration manually. For example, you may be using an unsupported version of Autodesk® Maya® or Autodesk® Maya LT™.

To manually install an Autodesk® Maya® or Autodesk® Maya LT™ Integration, follow these steps:

  1. Locate the UnityFbxForMaya.zip file. You can find it in Unity's Project view, under the Packages/FBX Exporter/Editor/Integrations folder.

  2. Extract the archive to a folder where you have write permission. This can be in or outside of your Unity Project.

  3. Copy the contents of Integrations/Autodesk/maya/UnityFbxForMaya.txt from the unzipped folder to the following file:

    • On Windows:
      C:\Users\{username}\Documents\maya\modules\UnityFbxForMaya.mod
    • On Mac:
      $HOME/Library/Preferences/Autodesk/Maya/modules/UnityFbxForMaya.mod
  4. In UnityFbxForMaya.mod, modify the following line (mel code):
    UnityFbxForMaya {Version} {UnityIntegrationsPath}/Integrations/Autodesk/maya

Set {Version} = 2.0.0 (or your version number of the FBX Exporter package) and {UnityIntegrationsPath} = the location where you unzipped UnityFbxForMaya.zip in step 1.

  1. Locate the following file (if it doesn't exist, create the file):

    • On Windows:
      C:\Users{username}\Documents\maya\scripts\userSetup.mel
    • On Mac:
      $HOME/Library/Preferences/Autodesk/Maya/scripts/userSetup.mel
  2. Add this line (mel code): if(`exists unitySetupUI`){ unitySetupUI; }

  3. Open Autodesk® Maya® or Autodesk® Maya LT™, and then open the Script Editor:

  1. Run the following (mel code):
    unityConfigure "{UnityProjectPath}" "{ExportSettingsPath}" "{ImportSettingsPath}" 0 0;

Where you replace {UnityProjectPath} with the path to your Unity Project, and {ExportSettingsPath} with the path to Integrations/Autodesk/maya/scripts/unityFbxExportSettings.mel and {ImportSettingsPath} with the path to Integrations/Autodesk/maya/scripts/unityFbxImportSettings.mel.

Working with Autodesk® Maya® 2017+
and Autodesk® Maya LT™ 2017+

Importing from Unity

Importing an FBX Model automatically configures the plug-in for export. The plug-in remembers your Unity Project, the export filenames for your Models and animations, and which objects to export per file.

Select File > Unity > Import to open a file browser directly in your current Unity Project.

Use the file browser to select the FBX files to import. One or more files can be selected at once. Hold Shift or Ctrl to select multiple files.

The FBX Exporter adds the contents of each imported file to an export set named after the imported FBX file. For example, if you import model.fbx, you can find its contents in an export set called model_UnityExportSet.

In addition, the contents of the file are placed into a namespace based on the filename. For model.fbx, the contents are placed into the model: namespace.

Animation files using the @ notation (modelname@animation.fbx), are recognized as animation files belonging to the Model contained in model.fbx.

For instance, if you import a file called model@anim.fbx, the export set and namespace name are based on the name before the @ symbol. Therefore, it uses the same set and namespace as model.fbx.

This allows animation files to be easily imported and applied to the appropriate objects in the Scene. Autodesk® Maya® and Autodesk® Maya LT™ store the animation filename and path for easy export. A single animation file is supported per model file. Importing a new animation overwrites the existing animation in the Scene.

Exporting to Unity

There are three options available for export in Autodesk® Maya® and Autodesk® Maya LT™:

  • Export
  • Export Model Only
  • Export Animation Only

File > Unity > Export exports both Models and animation contained in the export sets selected for export.

File > Unity > Export Model Only exports all Models in the selected export sets, but does not export any animation.

File > Unity > Export Animation Only exports only the animation applied to the objects in the export set as well as the minimum components required for the animation (such as transforms).

In order to export objects from the desired export set, you can select one or more objects in the set or the set itself. In either case, the FBX Exporter exports the entire contents of the set.

If you select multiple sets or objects from multiple sets, then the FBX Exporter exports each set to its respective file defined in the attributes of the set.

Create a New Export Set in Maya

In order to export objects that are not part of an existing export set, follow these steps to prepare an export set. First select the desired objects for export. Next, select one of the following menu items:

File > Unity > Create Export Set

File > Unity > Export

Select either of these options to create an export set with settings for exporting animation and model FBX files.

File > Unity > Export Model Only

File > Unity > Export Animation Only

Select Model Only or Animation Only export to setup an export set for exporting a model or animation file.

After selecting one of the above menu items, the following dialog will appear to set the options for the export set:

Property: Function:
Model File Path The file path to export to when calling File > Unity > Export and File > Unity > Export Model Only.
Model File Name The file name to export to when calling File > Unity > Export and File > Unity > Export Model Only.
Anim File Path The file path to export to when calling File > Unity > Export Animation Only.
Anim File Name The file name to export to when calling File > Unity > Export Animation Only.
Strip Namespaces on Export Check this option to automatically strip the most common namespace in the set on export (e.g. if most objects are in namespace model:, then model: will be stripped on export).
Create Set And Export Creates the set and immediately exports selection.
Create Set Creates set without exporting.
Cancel Cancels set creation and closes dialog.

Editing Export Set Attributes

After an export set has been created (through File > Unity > Import, File > Unity > Create Export Set, or one of the export options), it is possible to edit the export options on the set. In order to do so, select the set, go to the Attribute Editor, and modify the Unity attributes under the Extra Attributes header.

NOTE: If Arnold is installed, the attributes may appear in the Attribute Editor under Arnold > Extra Attributes

Property: Function:
Unity Fbx Model File Path The file path to export to when calling File > Unity > Export and File > Unity > Export Model Only.
Unity Fbx Model File Name The file name to export to when calling File > Unity > Export and File > Unity > Export Model Only.
Unity Fbx Anim File Path The file path to export to when calling File > Unity > Export Animation Only.
Unity Fbx Anim File Name The file name to export to when calling File > Unity > Export Animation Only.
Unity Fbx Strip Namespace Check this option to automatically strip the most common namespace in the set on export (e.g. if most objects are in namespace model:, then model: will be stripped on export).
Strip Specific Namespace (Optional) Specify a custom namespace to strip on export. When the Unity Fbx Strip Namespace checkbox is checked, the namespace in Strip Specific Namespace will be stripped; otherwise the most common namespace will be stripped if Strip Specific Namespace is left empty.

Working with Autodesk® 3ds Max® 2017+

Importing from Unity

Importing an FBX Model automatically configures the plug-in for export. The plug-in remembers your Unity Project, the export filename, and which objects to export.

Select Import to open a file browser directly in your current Unity Project:

  • In Autodesk® 3ds Max® 2018, select File > Import > Import from Unity.

  • In Autodesk® 3ds Max® 2017, select Unity > Import.

Use the file browser to select one or more Model(s) to import. You can hold the Shift or Ctrl keys to select multiple files.

The FBX Exporter automatically adds the contents of each imported file to a selection set named after the imported FBX file. For example, if you import model.fbx, you can find its contents in a selection set called model_UnityExportSet.

A dummy with the same name (model_UnityExportSet) is also created for each imported file and parented under another dummy object called UnityFbxExportSets.

This dummy contains the imported file’s path and filename as custom attributes, which the FBX Exporter also uses on export.

Custom attributes on a UnityExportSet dummy

The @ notation (modelname@animation.fbx), indicates that this is an animation file belonging to the Model contained in model.fbx.

For instance, if you import a file called model@anim.fbx, the export set is based on the name before the @ symbol. Therefore, it uses the same set as model.fbx.

This allows you to easily import animation files and apply them to the appropriate objects in the Scene. A single animation file is supported per Model file. Importing a new animation overwrites the existing animation in the Scene.

NOTE: Exporting animation only from Autodesk® 3ds Max® is not supported.

If the system units are not set to centimeters, Autodesk® 3ds Max® prompts you to change the system units to centimeters. Select one of the following options:

  • Click Yes to change the system units (recommended) to centimeters, ensuring that the scaling is maintained on export.
  • Click No to use the current system units (not recommended). The prompt does not appear again for the remainder of the Autodesk® 3ds Max® session or, in the case of a .max file, does not appear again for this file.

Export to Unity

There are two options available for export in Autodesk® 3ds Max®:

  • Export
  • Export Model Only

Export exports both Models and animation contained in the export sets selected for export.

Export Model Only exports all Models in the selected export sets, but does not export any animation.

Select either to automatically export with the settings and Models configured during import. No additional steps are required.

In Autodesk® 3ds Max® 2018, select File > Export > Export to Unity or File > Export > Export to Unity (Model Only).

In Autodesk® 3ds Max® 2017, select Unity > Export or Unity > Export Model Only.

In order to export objects from the desired export set, you can select one or more objects in the set, the set itself, or the corresponding dummy object. In either case, the FBX Exporter exports the entire contents of the set.

If you select multiple dummy objects corresponding to sets or objects from multiple sets, then the FBX Exporter exports each set to its respective file defined in the custom attributes of the set’s dummy object.

In each case, selecting Export automatically exports the current Model back to Unity. When you switch back into Unity, your Scene has already been updated.

Unity export uses the selection sets created on import to determine which objects to export. If you add a new object to the Model, you must also add this new object to the Model’s UnityExportSet set.

Click the Manage Selection Sets button to edit a UnityExportSet set.

To add an object to a set, select the set, select an object and click the Add Selected Objects button.

To remove an object from a set, select the object in the set and click the Subtract Selected Objects button.

TIP: You can also right-click the UnityExportSets and add or remove objects using the context menu.

In Autodesk® 3ds Max®, use the Add Selected Objects button (red outline) to add objects to the Wolf_UnityExportSet set.