Maya 2011 -> Unity 3.0 Recommended File structure?

Greetings Experts.

I am new to Unity 3.0 and Maya 2011.

I’m having trouble visualizing basic file structure to get the auto import to work within Unity for Maya Binary Scene files ( .mb )

My current most successful structure I’ve tried is…

  1. Create a new Unity Project
  2. Create a new Maya Project within the unity project “assets” folder. Create a new Maya Scene and SAVE.
  3. Open Unity. Unity Auto Imports all the Maya Scenes it finds within the Unity assets folder.

Here’s where it gets confusing for me…

  1. Unity generates a “materials” folder inside the maya scene project folder to store all the .mat files Unity creates to try and replicate the materials found in the Maya Scene files. Is the the correct place for it? It seems wrong for Unity to add it’s own files to a Maya Project folder structure. (so I may have set things up wrong)

  2. If I alter a maya scene’s geometry, SAVE and switch back to Unity the change is automatically picked up and the mesh object in Unity is updated.

  3. However, if I just change the colour of a standard Lambert material on the maya object (no texture), SAVE and return to Unity the color change is not updated to the Unity version of the object, or the Unity generated material linked to that material.

  4. Unity Re-Import / refresh doesn’t help on the mesh, the prefab, or the Unity generated material, nothing happens.

  5. The only way I can get the material to update is to delete the Unity generated materials in the Unity generated materials folder, and re-import the object. Everytime I change the colour of the material in Maya. This can’t be the correct workflow so I must be doing something silly.

So… Should I have my Maya project folder structure inside or outside the Unity Assets folder? If outside, how can I store the mb. Maya scene files in the Unity assets folder for them to be visible to unity, and be auto updated?

Any Unity.com file structure examples or books just have packages or .fbx files, so I can’t learn the ideal Maya structure from them.

Any advice on this and other workflow goodness much appreciated! :smile:

Richard

I’m pretty sure that you don’t want to have Maya project directories directly inside your Unity assets directory. Maybe that’s the recommended way for all I know, but it sounds like trouble to me. I would keep the project separate and just save/export your objects (not entire scenes, personally) into the correct Unity directory. I’m old fashioned, though, and even go so far as to set up materials manually in Unity after UV mapping them in Maya or Modo or whatever.

I just export models to FBX for use in Unity, rather than rely on it reading Maya files directly. If you uninstall Maya for some reason or decide you want to keep your Maya projects in a different place or drive, you’ll have headaches. You can easily script an “export to Unity” button in Maya and keep your projects themselves cleanly separated from Unity, just in case something goes crazy and Unity corrupts the project.

Interesting advice, many thanks for that.

Fbx export sounds sensible indeed.

Having seen the boast on the Unity site (all changes in Maya instantly updated in Unity) I’ll be interested to see if anybody has this feature working reliably.

Thanks for your time and swift reply!

Richard

What are you saying about materials sounds strange - that is supposed to work. I raised a case 379680 for that. I’ll test a bit later.

This should definitely work (unless there are bugs), so don’t let me put you off trying. I’m not a fan of Maya or it’s sprawling project directory layout, so I can’t really comment, although I do use it and Unity can certainly import from them. It definitely picks up changes in my exported FBX files the minute I save them and tab back to Unity, and this is a pretty core (and awesome) feature of Unity.

Hi there, thanks for your time, I really appreciate it.

I should add I’m currently using Maya 2011 HotFix 3 and Unity 3.0 with iOS license on Mac Mini Intel OSX 10.6.

(I also use Maya and Unity3 on PC but haven’t tested this issue yet).

Cheers

Richard

RichardSmith, I can reproduce your problem, but now I’m not certain it’s a bug - it looks like Unity was designed that way. The idea is that: you import your materials once and then you tweak them in Unity. For example if you change shader on your material and that shader with looks better with slightly different diffuse color, then you don’t want your color modification to be overridden from file when model is imported next time. Sure I can see situations where you might want to be able to tweak materials in Maya. I’ll discuss that with the team.

Aaahh, it may be that I’m just not getting the Unity workflow. I think it would be ideal if Unity updated materials upon saving in Maya, unless they had been modified by the user within Unity. Maybe that would be the best of both? If a user changes materials in Maya, then I think it should be reflected, as the change would have been deliberate if saved.

Whatever the outcome regarding the materials, maybe you would be kind enough to ask the dev team what their ideal file structure would be for Maya Unity? Just to make sure I get it right from the start.

Many thanks

Richard

Hi Paulius,

Was there any news on this issue, and whether I’m correct to save whole Maya projects within the asset folder?

Thanks for your assistance.

Richard

Yes, that could one of solutions. Another solution would be to have a checkbox “override material properties”. Both these solutions have their own drawbacks: first one makes it confusing, because you could modify material accidentally, the second adds yet another import option, which makes it harder to find other options.

Is it a really big issue for you? Why can’t you tweak material properties in Unity - the colors do not look exactly the same in Unity anyway. It just sounds like you’re taking different approach than most people.

I don’t think there is specific required structure - you’re free to do whatever you want, but if it was my choice I wouldn’t put Maya project in the same place.

Most people I’ve worked with ignore .max .mb etc and just use .FBX placing the textures in the same place as the .fbx folder so Unity finds them on import. Keeping the original 3D app files completely seperate from Unity. Using the native 3d file formats is convenient but often creates more problems than they are worth. Especially in larger teams with multiple artists using different tools.

Hi Paulius,

No its not hyper important to me, but stumped me for a while as unexpected behavior. I need to get used to the idea of creating materials in Unity (from my Director shockwave3D background, everything was setup in the 3D package first).

Thanks for your time and help!

Hi Tysoe,

Yes I’m starting to see that makes for a cleaner file setup. Ironically I purchased Maya (moving from Lightwave) specifically to streamline the workflow into Unity having read about the Auto Import on the promotional Unity pages. (But at least the FBX exporter in Maya is more solid than Newteks). Maya is very powerful for the UV / IK stuff too.

Cheers :slight_smile:

Yes and coders/developers may not have Maya/Max etc on their machines.
Unfortunately this is where the Unity workflow is a bit broken (it thinks/suggests you do have Maya on your machine and import the Maya file, not an fbx. Then double click the maya file to make changes - though even this does not work fully as stated with materials - but also major mesh reworks may be an issue too)
Thing is if a developer imports an fbx then adds it to the scene and then changes it somehow (tweaks a material, adds collision shape), the connection to the source/project fbx can be lost and when a new fbx arrives the scene version is not updated…

IMHO the workflow needs an update…

I rely on the automated maya import functionality and appreciate its usefulness. Here is how I work with it:

Create your maya projects in a separate location from your unity project. Well, actually it could be at the root level of the unity project directory if you want, as long as it is not in the Assets directory.

Do all your scratch work and messy scene history in that project. When you have a refined version that you want Unity to see directly (no extraneous stuff in the scene, etc.), save that version of the scene inside the Assets directory of the Unity project. I would recommend in a subfolder named Models or something particular to your project.

The main point is only the current “clean” version of the scene file should be saved inside the Unity project, and keep all the other stuff elsewhere.

Unity will automatically convert that file, and it creates a folder called Materials at the same directory level, where it puts all the converted materials from the scene. As noted, you need to do all your material tweaking in Unity because of the custom shaders.

The main tricky part is textures. Likewise, my sourceimages directory in the maya project might be pretty messy, but I will move the final textures to a directory called Textures at the same level as the maya scene file in the Unity project. Then relink the maya scene to the textures there (or not.) If the textures are there, Unity will find them and apply them to the materials for you. (see the Unity manual about the directory structure and paths it seeks through to find the materials and textures for a imported scene).

The nice thing with this is I can have Maya open and tweak the scene and just hit save and then flip back to Unity and everything updates.

Hope some of that helps.
I just started looking in this External Tools forum to see if anyone has written MEL and/or Unity Editor scripts that will take all the lighting setup from a Maya scene and rebuild it in Unity. Has anyone done that? If not, I was thinking about giving it a shot.

ap

Hi AndyZ and priceap,

Thanks for the helpful advice!

Richard