Book Image

Unity 2D Game Development Cookbook

By : Claudio Scolastici
Book Image

Unity 2D Game Development Cookbook

By: Claudio Scolastici

Overview of this book

<p>Unity is a powerful game development engine that provides rich functionalities to create 2D and 3D games.</p> <p>Unity 2D Game Development Cookbook is a practical guide to creating games with Unity. The book aims to serve the purpose of exploring problematic concepts in Unity for 2D game development, offering over 50 recipes that are easy to understand and to implement, thanks to the step-by-step explanations and the custom assets provided. The practical recipes provided in the book show clearly and concisely how to do things right in Unity. By the end of this book, you'll be near "experts" when dealing with Unity. You will also understand how to resolve issues and be able to comfortably offer solutions for 2D game development.</p>
Table of Contents (15 chapters)
Unity 2D Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exporting FBX files from Maya


Now that we are done with our first import, we can approach the many settings available in the Maya FBX exporter panel. There are several operations that require our attention, so follow us in our next recipe.

Getting ready

For this recipe, you just need the Maya model we used so far.

How to do it...

  1. Open the scene with the model in Maya.

  2. From the outliner panel, select the root node of your model. Be sure that the model is at the 0,0,0 position with 0,0,0 rotation.

  3. In the top menu window, navigate to File | Export Selection and the Maya exporter panel will open.

  4. Be sure that FBX export is selected from the drop-down menu at the bottom of the panel.

  5. Put a name you like in the File name field.

  6. From the Options... panel on the right-hand side, let's examine the first group of settings. Edit the General Options, Reference Options, and Include Options tab, as shown in the following screenshot:

  7. Now we can move to the next group of settings. In File Type Specific Options, make sure that the Include and Geometry settings are configured as shown in the following screenshot:

  8. Next comes the animation-related group of properties. Since we are not importing animations with an FBX file, unflag the Animation option entirely. This action will disengage all the following properties (see that they are barred in the following screenshot).

  9. Unflag Cameras, Lights, and Embed Media; we don't need any of them either.

  10. Flag Input Connections in the Connections tab. Refer to the following screenshot for the last three steps:

  11. Finally, in the Advanced Options tab, check that Units is set to Automatic.

  12. Check that Axis Conversion is set to Up Axis: Y.

  13. Check that FBX File Format is set to the latest Maya version available for your Maya installation (Binary FBX 2014, as we write). Refer to the following screenshot to be sure you have set everything correctly:

  14. Set a destination directory for the export, most likely the Asset\FBX directory in your Unity project.

  15. You can now press Export Selection to have the FBX file saved and ready to be used in Unity.

How it works...

As you can see, there is quite a lot that can be tweaked with regard to exporting FBX files from Maya. What we offered here was a basic outline that will do for most cases. It is very likely that, depending on the specific need that would rise with your own project, you may need to use different settings on specific tabs. In such cases, we suggest you to refer to the official Unity documentation, where an entire section dedicated to exporting from Maya is available.

Anyway, at some point, you will have determined the optimal settings configuration for your project and won't need to reset them every time. Once you get your optimal configuration, the only change will be with regard to the Animation tab. Don't worry about it now; we'll get to importing animations soon.

There's more...

If you check Unity's reference manuals (http://docs.unity3d.com/Manual/HOWTO-ImportObjectMaya.html), you may learn that Unity actually imports native Maya files, which means you can directly open Maya scenes (*.mb and *.ma files) in Unity. You can therefore ask, Why export FBX files into Unity at all?

There is more than one reason actually; one that is worth $4,000 is that FBX files are far more shareable than native Maya files. For example, to open a Maya scene in Unity, you must have Maya installed or the file won't open. If you expect to exchange files between people on their own PCs, you cannot assume that each one of them will have a Maya license. It will thus be safer to use formats that don't require additional costly software, as is the case with Maya (almost $4,000 per license).

That said, it is still quite useful to open Maya scenes in Unity. For example, in Unity you can immediately check the result of modifications made on a file in Maya without the need to export an FBX file with each new edit. Also, as already stated, Maya LT is going to export FBX file directly into Unity.