Search Unity

Swap .MB files for .FBX without breaking everything?

Discussion in 'Asset Importing & Exporting' started by torahhorse, May 19, 2017.

  1. torahhorse

    torahhorse

    Joined:
    May 14, 2013
    Posts:
    10
    I have a large project that uses .MB files for the art assets, which I deeply regret lol. Nobody can import these files unless they have the same Maya version installed (2012, which they dont even sell any more haha).

    I'd like to convert all the .MB asset files to FBX, but since the prefabs generated from the MB files are referenced in numerous scenes, it's really costly and error-prone to import a new FBX and replace every instance of that prefab in every scene.

    Is there a way to replace an .MB asset with an .FBX "in place" so to speak, so that Unity at import considers it the same asset and updates the prefab? I know Unity is converting it to FBX at import time anyway, so it seems doable? Maybe editing the meta file?

    Thanks for taking a look!!!
     
  2. torahhorse

    torahhorse

    Joined:
    May 14, 2013
    Posts:
    10
    Update!
    This process seems to work!!
    1. Open MB file in Maya
    2. Export an FBX with the same name in the same directory as the MB
    3. Before opening Unity again, navigate to the file in Explorer
    4. Rename the meta file from somefile.mb.meta to somefile.fbx.meta (to match the new FBX we created)
    5. Delete the MB file
    6. Open Unity. Unity imports the FBX file and maintains all references and prefabs as if it were the MB.
    Now... is there a neat way to automate this process? Maybe inside the Unity's FBXMayaExport.mel script? I'm a little out of my depth here, so if someone is familiar with that pipeline, I'd love to hear your thoughts :)
     
    Sparkline likes this.
  3. torahhorse

    torahhorse

    Joined:
    May 14, 2013
    Posts:
    10
    Another Update!

    The method described above does NOT preserve model-generated prefabs nested inside other prefabs. All the mesh references break (I guess I shouldn't be surprised LOL). So you have to manually fix those...
     
  4. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    You're focusing on replacing the source geometry, where you might have an easier time updating the prefabs instead.
    If you don't have too many prefabs then you could do this by hand: place an instance of each prefab in an empty scene, replace their contents and Apply over the original ... keep versions/backups!

    Alternatively you could attempt to automate it i.e. via AssetPostprocessor, which is very flexible but can be a bit cranky sometimes.

    Lesson learned either way: as convenient as it looks, it's totally not worth using the native file import feature :)
     
  5. env_warby

    env_warby

    Joined:
    Nov 22, 2013
    Posts:
    23
    THANK YOU for posting this mini tutorial. I am currently in the process of converting a project you ay have saved me weeks perhaps even month of work.