How to Import Custom Properties from Maya into Unity

Custom Properties have been a core feature of Maya for years, and they have become ubiquitous in the fields of rigging and animation for their power to transfer animation data between objects in your scene.

Importing Custom Properties from Maya into Unity using the fbx format is a simple process as long as the animation data meets a few basic requirements. This procedure will transform any Custom Attribute attached to an exported object into a float Property that can be read by that object’s Animator component.

The fbx format is incredibly versatile, and the pipeline for bringing an fbx file into Unity from Maya is very well documented. Although this process can get complicated, for our purposes there are only a few steps we need to take.

This procedure works in any version of Maya that can export to fbx, including both the educational version and MayaLT.

Table of Contents

Creating your custom attribute

To create a Custom Attribute in Maya all you need to do is select the object to which you want to assign the attribute, and select Add Attribute from the Modify menu.

Unlike preparing your asset for the Unreal Engine (in which skeleton hierarchy is more important) it really doesn’t matter which object to which your Custom Attribute is attached. You could apply it to a joint, directly onto your mesh, or even to a null object like a Group, just as long as it exports to fbx.

My suggestion would be to add them somewhere easy to find, especially if you’re planning on adding more than a few. The main mesh of your object or the root joint of a character are logical spots.

When you go to add your custom attribute, you’ll be asked to provide it with a long name. This is a string which acts as an identifier for the attribute. You’ll also be given the opportunity to create a custom nice name, which is intended to be a more human-readable (and animator friendly) version for the Channel Box.

When exporting your asset the fbx exporter will use the attribute’s long name, so make sure you name it something you’ll recognize on the other side.

In Maya you have a range of data types to choose from when making your Custom Attribute, but in Unity you have only one, the float curve. If you pick any other type of data Unity won’t import it.

Two last important things you’ll need to remember about preparing your asset for export:

  • Unity will only import Custom Attributes if they have animation data assigned to them. Just a single keyframe will suffice, just as long as there is something there to pass into an Animation Clip.
  • Your Maya animation will need at least one keyframe on a standard attribute for Unity to read your Custom Attributes. Unity won’t create an Animation Clip at all unless one of the standard attributes (translation/rotation/scale) is keyed. I’m not sure why this is, but if it bothers you just delete the keyframe in Unity after importing your fbx.

Exporting your animation to fbx

Once you’re happy with your Custom Attributes and you’ve added your animation, you’ll need to export your asset to fbx. To do this, select both the mesh you want to export plus the root joint of your skeleton (if you have one) and hit File > Export Selection.

Side note

If you’re exporting just animation data to apply to an existing mesh in Unity, you may only need to select the skeleton. However, if you have any Custom Attributes assigned to the mesh you’ll need to export both.

By default, the plugin that handles fbx import/export may not be loaded. If the fbx option is missing from your list, make sure you enable fbxtomaya.mll in the Plug-in Manager.

Maya’s fbx exporter has a lot of options, but luckily for our purposes we can keep most of it set to default. You will need to make sure you have checked the Animation box, or the fbx will ignore all of your animation data. Additionally, if you’re using a skinned mesh with joints you’ll also need to make sure to check the Deformed Models/Skins box.

There is a lot more to the fbx exporter, but if you want to play it safe I suggest you use the Autodesk Media and Entertainment preset with just the above changes within the Animation section. If you want to export your mesh normals you should also check the Smoothing Groups box. The rest can be left as-is.

Importing your Custom Attributes into Unity

Bringing your new fbx file into Unity is as easy as dragging it into your project. If all has gone as expected your new Unity asset should have a few objects inside it, including an Animation Clip (usually called Take 001).

Unity stores imported animation data in Animation Clips. This is a collection of named attributes with keyframes assigned that dictate that attribute’s values over a specific duration. This is also where your Custom Attribute data will be stored.

If you don’t have an Animation Clip, something might have gone wrong with the export. Double check your settings in Maya in case something was missed. If you get stuck you can always send me a message.

By default Unity will ignore Custom Attributes. This can be changed on a per-asset basis by selecting the main object, navigating to the Animation tab, and checking the box Animated Custom Properties. It’s that easy.

There are a few ways you can confirm that Unity has correctly imported your animated properties:

Custom Attributes within Animation View

The simplest way to confirm your data has come across is to open the Animation View (Window > Animation > Animation) and to select your Animation Clip in your Project.

If the import has been successful you will see your attributes as animated properties.

Keep in mind

Animation Clips that are stored in your fbx files are read only. If you want to jump in and start animating within the engine you’ll need to duplicate it first and work out of the copy.

Custom Attributes and Mecanim

Imported custom properties can be applied directly to the parameters within an Animation Controller, providing a lot of interesting utility without needing to jump into code.

To do this all you need to do is create a parameter within your Animation Controller with the same name as your attribute (ie. the long name you gave it in Maya).

When your animation plays, the attribute’s value will automatically be applied to your parameter. What you do with this power is up to you!

Final Thoughts

Thanks a lot for following along.

I am endlessly fascinated by the creative ways we can apply these technical animation techniques to our games and use them to get more out of less. I still have so much to explore, and if I feel like I can appropriately explain what I discover I’d be excited to share it with you as well. I hope you’ll join me again next time.

Until then!

I am a technical artist from Adelaide, Australia. I created techarthub to share my knowledge and love for this industry. I hope you feel it too!

Related Posts
Seven different techniques you can try that will significantly lessen the amount of time it will take to compile your shaders.
A step-by-step guide to making your own bullet impact textures in Substance Designer.
Scroll to Top