In the previous movie, we covered the inspiration and technical considerations that went into the making of this Hyperspace Madness mobile game. In this movie, we’ll create the primary sections of our game level in Maya LT and then assemble them in Unity. We’re using the Unity pro version to build this game, but the workflows being covered here are also applicable to the free version. Start by creating a new Unity project and set its location to a new folder on your hard drive named “HSM_Game”. We don’t need to import any packages so leave the list as is and click Create. Unity loads the new project. Go to Assets>Show in Explorer to display the folder structure created by Unity. The Assets folder within is where you’ll store all the 3D models, textures, and scripts produced for this game. What we won’t store there, however, are all the Maya LT production scenes. For those, you’ll create a new “HSM_Game_Source” folder next to our Unity project. We want to keep these two sets of folders separate so that we can store our iterative production files in one location, then export them as lighter FBX files to the Unity project folder. This helps keep your Unity project folders organized and clutter-free. The necessary source assets for this part of the tutorial are available for download with this movie. Copy them into the new folder. We’ve set up the source assets using a project folder to facilitate path linking and asset sharing, which is particularly useful when working in a team. In Maya LT, set the provided source assets folder as the current project. For a refresher on how to set and configure project folders, refer to the “Setting a Maya project” how-to movie on the Autodesk Maya Learning Channel. Open the file “platform_source.mlt”, or import “platform_source.fbx” into your current scene. We’ll use these objects as building blocks for the different platform sections in our level. When dealing with objects designed to run in a game engine, it’s important to be mindful of their polygon count. Since these objects will be duplicated numerous times to populate our level, the resulting polygon count can quickly become considerable. This can impact the game’s performance at runtime depending on the hardware you’re developing for. Since our goal is to publish on mobile devices, we’ll need to optimize our assets accordingly. Here, in addition to a reduced polygon count, these objects all share the same 512×512 resolution textures, as opposed to having duplicated materials and textures. This will facilitate how the Unity game engine accesses them at runtime. We’ll come back to this later. We’ll also highlight other optimization best practices as we produce and integrate our game assets throughout this series. First, open your preferences and make sure that in Settings, your angular working units are set to ‘degrees’. We’ll use the singular platform tile to create a multi-tiled straight path. Hide “ramp_grp” and “corner_grp”. Select the platform, and then go to Edit>Duplicate Special [Options]. Reset the settings, and then set Geometry type to “Instance”. Instancing an object links the duplicate to the original mesh, which means any changes we apply to the original platform’s geometry will propagate to its instances in the scene. Set Translate to 512 units in the X axis, which is precisely the platform’s width, to offset the instance by that amount. Set Number of copies to 5, and click Duplicate Special. Group all six platforms as “section_straight_grp”. Next, let’s create the ramp section by instancing the current platform tiles. Note that we want to instance only the platform tiles and not their group, or else the instancing process will impact the transforms of the duplicated platforms. In the Duplicate Special Options window, set Group under to “World”, Translate to 0 units in the X axis, and Number of copies to 1. Group the duplicated platforms as “section_ramp_grp” and hide the original “section_straight_grp”. Unhide “ramp_grp” and parent it to “section_ramp_grp”. Then, move it 950 units in the X axis to line up with the end of the second platform. Move two other platforms 315 units in the Y axis to connect to the top of the ramp. Delete the two unused platforms. To build a downward ramp section, we could repeat this process and just mirror the ramp. But a better idea would be to create both ramp types in Unity using this same object, which reduces the amount of objects to deal with. Using the techniques you’ve learned so far, you can use the straight section and corner groups to create the three types of platform extensions. These extensions are not part of the gameplay layer, but rather in the middle-ground layer, which we’ll populate with extra characters, buildings and accessories in a later movie. We’ve included a “platform_source_result.mlt” scene and corresponding .fbx file containing all the sections needed. At this point, we could export each of these section groups separately to FBX files and import them into our Unity scene. However, we would end up with lots of individual objects, which can impact performance at runtime. To avoid this, it’s preferable to reduce the amount of draw calls, which is the number of times the Unity engine has to go to the GPU in order to draw, or render, each object onscreen at every frame. The less calls Unity has to make per object, the more chances you’ll improve the frames per second, or fps, at runtime. So how can we optimize these platform sections to achieve this? All the sections we created so far already use the same set of materials and textures, so that already reduces the amount of draw calls Unity has to make to render them. In addition, if we combine each of these groups into single meshes, Unity won’t have as many objects to render, which in turns also means less draw calls and thus increased performance. This type of optimization benefits objects categorized as “static objects”, meaning those without animation. Duplicate “section_straight_grp” so we don’t alter the original source asset. Use the Mesh>Combine command to merge the group’s contents together. Go to Edit>Delete by Type>History to remove the construction history from this new object. Delete the leftover nodes. Rename the resulting object “section_straight_geo”. Repeat this process for the remaining sections. Now to export your objects to Unity, you can either use the File>Export commands … … or use the “Send to Unity” menu. Note that you must enable “GamePipeline.mll” in the Plug-in Manager to see this menu. While both methods use the same FBX export command, the “Send to Unity” menu adds a few more steps to the export procedure. Maya LT first checks for an installed version of Unity on your system. If so, it removes the default 65000 polygon limit for all FBX exports. It then prompts you for the location of the Unity project folder you wish to export to. Maya LT will use that project’s Assets folder as destination. Name your resulting FBX file “section_straight”. In the Options pane, under Presets, choose “Autodesk Media & Entertainment”, which is a good all-around template to start from. Expand the Include>Animation section and uncheck the “Animation” option since our platforms are static objects. This forces Maya LT to disregard any animation-related options on export. Expand the Advanced Options>Units section. By default, Maya LT uses centimeters while Unity works in meters. Enabling the “Automatic” option lets FBX do the unit conversion for you. Under FBX File Format, make sure you’re using “FBX 2014”. Click Export Selection. Export the remaining sections using the same preset configuration. Copy the Textures folder from your local “HSM_Game_Source” folder to your Unity project’s Assets folder. Unity imports your new objects and lists them in the Project view, which reflects your Unity project’s folder structure. It also imports each object’s corresponding materials and stores them in a Materials folder. During this process, Unity may prompt you to update your normal maps’ import settings. Click Fix now. Select all the imported objects. The Inspector displays their respective import settings, categorized in three tabs. In the Model tab, notice the Scale Factor displays the unit differences between Maya LT and Unity. Set Material Naming to “From Model’s Material”. Click Apply. This tells Unity to name the imported materials based on their original name in Maya LT, which makes it easier to tell them apart. Next, in the Rig tab, set the Animation Type to “None” to tell Unity to remove the Animator or Animation components from these assets. Click Apply. Now drag “section_straight” from the Assets view into the Hierarchy. This automatically places it at your scene’s origin. The Inspector lists all your game object’s properties, much like Maya LT’s Attribute Editor. We’ll explore many of its properties in the following movies as we flesh out our game. At this point though, we’ll just focus on populating our game world with basic assets. We could start duplicating this platform over and over to populate our level. However, this isn’t advisable since each platform duplicate would be considered an independent object. Just like how we used instances in Maya LT to link our objects’ geometry together, we can use smart templates, or prefabs, to link all our platforms in a similar way. This way, if we make adjustments to the prefab’s properties, all instances of that prefab within our level will get updated. First, go to Assets>Create>Prefab. In the Project view, rename it “prefab_straight_static”. As a convention, use the “prefab_” prefix to isolate it from other game objects, and use the “_static” suffix to identify it as a static object. Now drag your first platform from the Hierarchy onto the new prefab game object. Its icon turns blue. The Inspector displays your game object as “Prefab”. Turn on the “Static” property and click Apply. Unity will now evaluate all instances of this prefab as a static object. Delete any remaining non-prefab platforms, then create two new prefabs named “prefab_rampUp_static” and “prefab_rampDown_static”. As explained earlier in this movie, we’re going to use the same ramp object to create two different ramp prefabs. You can now create additional prefab platforms and use them to build your own level layout, or use ours as reference. Save your scene as “Game.unity”. In the next movie, we’ll animate our main character Sven and integrate him into this level.