Home Unity

Unity Level Editing and Maya

mbreddit54
polycounter lvl 9
Offline / Send Message
mbreddit54 polycounter lvl 9
I've been using Maya to create assets for Unity. In general I'm happy with the results. I'm wondering what kind of workflow most people are using for complex level design going from Maya to Unity. What I've been doing in general is cutting up chunks of the environment in Maya and then importing them to Unity and placing the prefabs manually.

Does anyone have a more improved workflow where you can keep the level intact in Maya and then do a somewhat 1:1 import into Unity? How are you guys doing it?

Replies

  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya you can just instance objects around in maya, and export your whole scene out as fbx.

    unity should maintain the scene hierarchy, so you should be able ot drag the whole thing into the unity scene set it to 0,0,0 for location, and once in the scene like that any changes in maya should show in unity, and in unity because it still has a scene hierarchy, you can select the individual objects still and apply materials and effects to them.
  • mbreddit54
    Options
    Offline / Send Message
    mbreddit54 polycounter lvl 9
    Thanks for your response.

    I guess after the initial import of the scene layout you need to manually update individual meshes since reimporting the whole scene will get rid of all the material assignments. It really would be great if Unity had a way of reading meta data from Maya that says "Use this Material".
  • mbreddit54
    Options
    Offline / Send Message
    mbreddit54 polycounter lvl 9
    After a bit more poking around I think I figured it out. Here are the steps I'm currently using. It should be said that this is the setup I'm using for a single file export of base level geometry.

    1) Export the scene from Maya to the Unity Assets folder. (I use a sub folder called Level Geometry).

    2) Create and empty game object in Unity at 0,0,0.

    3) Drag the imported asset into that game object.

    4) Rotate the game object by 180 degrees. This allows the axis layout in Maya to match the layout in Unity. I use maya set to centimeters. This allows me to do a 1:1 import into Unity at scale, but I treat 1 unit in Unity as 1 meter and 100 units in maya as a meter.

    5) Continue to work in Maya and export selected objects as the main level geometry. Note the entire "scene" is one FBX export. To export all the objects I select them all and export the entire selection as one FBX. This limits the export selection to only the objects. (no cameras or lights).

    This also seems to preserve materials that have been setup on the objects that are placed in Unity. I have both apps open at the same time on separate machines linked with a shared folder.
  • mbreddit54
    Options
    Offline / Send Message
    mbreddit54 polycounter lvl 9
    I also created a shelf button that contains the following code:

    SelectAllGeometry;
    ExportSelection;

    You can put that in your script editor and then save it to a shelf. This allows the geometry in the scene to be selected and the export dialog to be opened. I then export again over my the FBX scene in the Unity Assets folder and reimport the asset in Unity to update it.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I wrote a FBX export wrapper that exports objects in named groups, each group as a separate FBX file. So it builds a list of paired objects (based on their name before and after the "_" character), and exports each of those groups at 0,0,0 positioned to a individual FBX file.
    7581102260_2cf3bb5de3_o.jpg
    This way I can have all the scene objects in Max and just roughly select all the elements I want to export or update.
  • gsokol
    Options
    Offline / Send Message
    Yea Exporting whole scenes works fairly decently.

    If you name your materials properly and assign the correct materials to all geo then you wont have problems with the materials. The problem arises when you re assign materials in Unity, then re-import.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    gsokol wrote: »
    Yea Exporting whole scenes works fairly decently.

    If you name your materials properly and assign the correct materials to all geo then you wont have problems with the materials. The problem arises when you re assign materials in Unity, then re-import.
    You can create a import editor script that prevents unity from importing materials. Like rename this to "MeshPostprocessor.cs" and drop it in the "Editor" folder
    using UnityEngine;
    using UnityEditor;
    
    class MeshPostprocessor : AssetPostprocessor {
    
    	void OnPreprocessModel () {
        	(assetImporter as ModelImporter).globalScale = 1.0f;
    		(assetImporter as ModelImporter).swapUVChannels = false;
    		(assetImporter as ModelImporter).generateMaterials = ModelImporterGenerateMaterials.None;
    		(assetImporter as ModelImporter).generateSecondaryUV = false;
    	}
    }
    
    Still sometimes these auto behaviors of Unity are the things that break the workflow.
  • cupsster
    Options
    Offline / Send Message
    cupsster polycounter lvl 11
    Actualy you can extend Unity postprocessors in a way that it will completly build your scene from provided data, models and textures.. Or if you are skilled enough you can make scenes directly in code cause unity now supports text scene format, not just binary.. imagination is your limit.. ;) by the way @renderhjs good example
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    I have an issue where Unity wants to re-import every time you copy a file (From a post-processor I wrote). There has to be a way around that.
  • mountains
    Options
    Offline / Send Message
    mountains polycounter lvl 10
    good solution. I will use it. thanks...
  • stefaum
    Options
    Offline / Send Message
    A good tip is to always merge objects that share the same texture/material, it will help to reduce drawcalls
Sign In or Register to comment.