Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Official New FBX Exporter in 2017.2

Discussion in 'Asset Importing & Exporting' started by ans_unity, Oct 12, 2017.

Thread Status:
Not open for further replies.
  1. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi Quatum1000,

    Are you using legacy material import?
    If so, try changing the naming setting to "From Model's Material" and reimporting.

    upload_2018-1-18_12-58-0.png

    You might have to delete the old material with the texture name for the change to take effect.

    Actually it is already possible to choose the folder to convert linked prefab to :)
    To change the folder, go to Edit->Project Settings->Fbx Export Settings and modify the "Export Path" to the desired
    folder inside of your Assets directory.

    upload_2018-1-18_12-59-0.png

    Best,
    Viktoria
     
    Quatum1000 likes this.
  2. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    * My pro 2017.1.x does not support materials option in inspector. Seem it's supported since 2017.2 only?
    * Scanline Standard is the only one I use.

    1) Sometimes I want to export an model from max into uinty, but clicking export in max does not prompt me for the file select box. I think unityFbxFilePathAttr is !=null . Do you think there is a chance for "unity export as ... " in max/maya that set unityFbxFilePathAttr by unity export as ... " ?

    The curios thing is, I can't get rid of the reference to the original.
    I saved the model with a different name, restarted max, loaded the new named max file.... and the unity export overwrite the old reference fbx file in unity without a piece of shame. :)
    Destroying the export path should be urgently possible without:
    Code (CSharp):
    1. unityFbxFilePathAttr=undefined;
    2. unityFbxFileNameAttr=undefined;


    Another issue:
    Opening the fbx file in unity 2018 with max and reopen back on unity 2017 cause an error on reimport.

    IndexOutOfRangeException: Array index is out of range.
    UnityEditor.AssetImporterTabbedEditor.OnEnable () (at C:/buildslave/unity/build/Editor/Mono/Inspector/TabbedEditor.cs:85)
    UnityEditor.ModelImporterEditor.OnEnable () (at C:/buildslave/unity/build/Editor/Mono/ImportSettings/ModelImporterEditor.cs:17)

    Untitled-1.gif
     
    Last edited: Jan 18, 2018
  3. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Woops sorry I was using Unity 2017.3. The same setting exists in 2017.1 except in a different location (see image below).

    upload_2018-1-19_12-27-9.png

    1) Yes this is normal as these variables get saved into your .max file. I can see how it can be frustrating though.
    I'll add this as an issue along with your proposed solution. Thank you for the feedback!

    For now, a workaround that doesn't involve manually setting those variables to undefined is to do File->New->Keep Objects and Hierarchy.

    upload_2018-1-19_12-31-18.png

    This will create a new scene that keeps the same objects and hierarchy you had before, as well as clears the unityFbxFilePathAttr variable.

    However, this will also clear the UnityFbxExportSet, which you can either recreate manually, or instead select the objects in the hierarchy before export.

    Sorry I'm not sure I understand the workflow that caused the error. Are these the correct repro steps?:

    1. Create model in 3ds Max
    2. Export to Unity 2018
    3. Close Unity project
    4. Open same Unity project in Unity 2017

    I was unable to reproduce the error with these steps. If possible, could you please send me the fbx file that caused the issue?

    Best,
    Viktoria
     
  4. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    args, sometimes stuff is simply overlooked. Thanks.


    Today the error does not occur on the same procedure and asset I can't say that the error occur on a linked prefab instance or an simple imported fbx, and that happen because of the open max program or active synchronizing dropbox activity. The dependencies are to complex.

    Does Rotation of a mesh is not handled by the fbx exporter?
    + I imported the linked prefab instance
    + rotated the single mesh
    + and export again.
    The new rotation from max is not applied to the fbx file.

    Anyway, I have some quirky problems with the exporter/importer. Each export, double the meshes.
    I have PM a video to you.
     
  5. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Great that there's no more error but it's unfortunate that we don't know what caused the error in the first place :/
    Let me know if you see the error again or if you find a way to reproduce it.

    Export of rotation from 3ds Max should be handled by the fbx exporter plugin. If you import the fbx back into a new Max scene, do you get the correct rotation?

    Is it possible that it is the prefab's root rotation that is not updating? If so, then this is the expected result.
    The reason for this is that if there are multiple instances of a prefab in the scene placed in different locations,
    in most cases it is undesirable for all of them to move to the same position and rotation if the original
    prefab's position/rotation changes.

    In order to bypass this, you could add an empty GameObject to the root of the hierarchy and rotate its children instead.

    Best,
    Viktoria
     
  6. jschroyen

    jschroyen

    Joined:
    Aug 19, 2015
    Posts:
    22
    I've been doing some tests.
    I have a linked Fbx Prefab in Unity working all good.
    Then I take the model, in maya, and skin it to a joint, export FBX, then update the model import settings for a rig in Unity, the Linked Prefab is updated with a Animator and Skinned Mesh Renderer. But the skinned mesh is not bound to the joint found here.
    If I pull the model into the scene it is skinned as expected.

    Is that a bug, a coming feature, or am I doing it wrong?
    Cheers
     
  7. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Hey there all,

    So I was just trying to install the Unity FBX Integration plugin using Maya LT 2018.2 which once again failed. 1.2.0.b1 of the plugin states that it works with Maya LT 2017 and up. However, in the Readme.txt it states that it's not working with Maya LT. So there are conflicting statements.

    I tried installing the plugin a few times but I just can't seem to get it to work leaving the impression that support for Maya LT 2017+ is indeed still not an option?

    Thomas
     

    Attached Files:

  8. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi jschroyen,

    We're still working on supporting skinned mesh export/import with the exporter package.

    The issue you're seeing is caused by the fact that we are not updating the bones of the skinned mesh in the prefab to point to the bones in the prefab.

    Thank you for your feedback!

    Best,
    Viktoria
     
  9. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi Thomas,

    Maya LT is supported in version 1.2.0b1 of the exporter package. We failed to remove the line in the README saying that Maya LT is not supported. Thank you for bringing this to our attention and sorry for the confusion.

    Do you get any error messages in Maya LT or Unity when installing the plugin? If so, could you please send them to me?

    Best,
    Viktoria
     
  10. akaButtons

    akaButtons

    Joined:
    Aug 2, 2015
    Posts:
    6
    Hi all,

    I tried following the demonstration video as a guide on how to use the tool, but when I try to export a plain cube that's been resized (from Unity to Maya, using the basic Unity cube), the file that Maya reads in shows a plain 1x1x1 cube. The exported model doesn't seem to be getting any of the Transform data of the prefab, even though that's what's shown in the video.

    Is this a bug, or is there just a setting I've overlooked?
     
  11. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    I tried to install it again just now. I don't get any error messages. As soon as Maya LT starts up (after clicking the Install button) Unity will just hang. I have to force quit it. The installation only ever fails on my end. I find the process also a bit confusing to say the least.
     
  12. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    228
    I've attached an fbx from maya 2017 with "Preserve Instances" Actived. Gets imported into Unity correctly. After Export and reimport, instances are gone.

    My use case is, that I have a model without instances and wrote a unity script which searchs the scene for identical geometry and relinks the instances. Without/With Optimisation (100 MB vs. a few MB I hope):
    upload_2018-1-31_12-42-58.png upload_2018-1-31_12-43-24.png
     

    Attached Files:

  13. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi NraButtons,

    The transform of the root GameObject is not exported when going from Unity to Maya.
    In order to export the transform of the cube, you can parent it under an empty GameObject,
    then change the transform on the cube.

    The reason for this is so that in Maya the object is imported in the world center with the default
    rotation and scale.

    In the future we propose that if you export a single object, we'd only reset the transform if the center
    object option is on, otherwise it would export as is. For the convert to linked prefab option, we'd
    export with the center object option on. Would this address your issue?

    Best,
    Viktoria
     
  14. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Could you please send me the Maya LT and Unity log files?

    The Maya LT log file can be found in:
    Windows: C:\Users\[user name]\AppData\Local\Temp
    Mac: ~/Documents/temp

    Unity log file can be found at:
    Windows: C:\Users\username\AppData\Local\Unity\Editor\Editor.log
    Mac: ~/Library/Logs/Unity/Editor.log

    Best,
    Viktoria
     
  15. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi pojoih,

    Thank you for sending over the models. I was able to recreate the issue on my side and it is indeed a bug with the FBX exporter. I have logged the issue and will let you know when the fix is available.

    Best,
    Viktoria
     
    pojoih likes this.
  16. ans_unity

    ans_unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    124
    Hi everyone,

    We're pleased to announce a preview alpha release of the FBX Exporter package with animation support and we would love your feedback.

    NEW FEATURES
    • Added support for exporting SkinnedMeshes with legacy and generic animation.
    • Added support for exporting Lights with animatable properties (Intensity, Spot Angle, Color).
    • Added support for exporting Cameras with animatable properties (Field of View).
    • Added ability to export animations on transforms.
    FIXES
    • Universal Windows Platform build errors caused by UnityFbxSdk.dll being set as compatible with any platform instead of editor only.
    We will continue our work on the FBX animation pipeline, more precisely on:
    • Exporting only a character's animation as well as exporting the character with no animation
    • Supporting exporting characters that are animated from Timeline.
    • Adding support for exporting animated parameters from a character's Animator controller as custom properties.

    Kindly share your comments to help us improve the feature.

    You can download the package here.


    Note: The FBX Exporter is a “Restricted Asset” under the Asset Store End User License Agreement and is subject to the Unity Companion License 1.0. Further, use of the Autodesk FBX SDK is subject to your acceptance of and agreement to the FBX SDK License and Service Agreement terms.
     
    Last edited: Feb 1, 2018
    imgspc and vkovec like this.
  17. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    609

    Thank you for the screenshots and explanation. I'll give it a try again
     
  18. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    609
    Hi,
    yea it's a custom material (3dsmax) that I was testing with. But I haven't had time to go back to try out FBX exporter. I'll try again later , with your new suggestions. If I still run into the same issues, I'll save off a copy of the max file and send to you.

    Thanks
     
    vkovec likes this.
  19. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi Tinovdk,

    We tried to recreate your issue with the fbx file becoming corrupted when transferred through Perforce but haven't been able to reproduce it.
    Which import settings did you set in Unity and which export settings in 3ds Max?

    Also, have you tried with the latest version of the FBX exporter (v1.2.0b1)? If so, do you still get the same issue?

    Best,
    Viktoria
     
  20. atf-smathieu

    atf-smathieu

    Joined:
    Dec 4, 2017
    Posts:
    4
    Hello,

    We tried your Fbx Exporter Package 1.3.0a1 in Unity 2017.2.0f3 and Maya 2017 update 5. It works great but we are experiencing issues when using it with skinnedMesh objects.

    After updating our fbx in maya with a skinned object we export it to Unity. There, the skinnedMesh component is present in the fbx file and in the prefab as we set the animation type from none to generic in the rig tab.

    In the latter case (prefab) the mesh doesn't react to animation has if the object has no skinning (while the component exists). The bones are correctly moving.
    The whole process works well without skinnedMesh objects

    Is there a way to make it work ? Is it a known issue or do you plan to support it in a near future and if so, what is the release date?

    Thank you for your help.
     
  21. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi atf-smathieu,

    Thank you for trying the package and for the feedback :).

    Yes, the skinned mesh not updating properly in the prefab is a known issue that we will work on fixing for a future release.
    Unfortunately there is currently no good workaround, but I will let you know when the fix is available.

    Best,
    Viktoria
     
  22. AlaiMich

    AlaiMich

    Joined:
    Aug 13, 2017
    Posts:
    5
    Request: Include support for transparency animation and animations involving modifiers (Ex: Slice) from 3DS Max to work in Unity.

    I have a project where a building construction sequence has been modeled and animated in Max but animations with modifiers or transparency settings don't come through to Unity. If anyone can guide me in the right direction I'd appreciate it very much!!!
     
  23. imgspc

    imgspc

    Unity Developer - FBX Exporter

    Joined:
    Aug 22, 2017
    Posts:
    13
  24. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi AlaiMich,

    A possible workaround could be creating and animating custom properties in 3ds Max instead of animating the transparency/modifiers directly. Then hooking into those properties in Unity to set the transparency.

    These are the general steps to take:

    1. In 3ds Max select the object to add a custom property to, then open the Parameter Editor (Animation->Parameter Editor...)

    2. Set the type, name, and any other desired settings on the parameter then click "Add"

    upload_2018-2-15_12-35-0.png

    3. Below the time slider, click the "Key Filters..." button and make sure "Custom Attributes" is checked

    upload_2018-2-15_12-35-47.png

    4. Animate as before, except using the newly created custom attribute to set the transparency.
    The custom attributes can be found in the "Modify" tab on the selected object
    upload_2018-2-15_12-38-1.png

    5. Export to Unity

    6. In Unity select the FBX in the Project tab and check "Animated Custom Properties" in the Animation import settings

    upload_2018-2-15_12-38-45.png

    7. You should now be able to see your animated custom property in the animation clip

    upload_2018-2-15_12-40-4.png

    8. Write a script to access the animated custom property value and set the transparency in Unity
    e.g.
    Code (csharp):
    1.  
    2. Animator animator = gameObject.GetComponent<Animator>();
    3. float currTransparency = animator.GetFloat("transparency");
    4.  
    5. // use currTransparency to set transparency of desired object/material
    6.  
    Best,
    Viktoria
     
  25. atf-smathieu

    atf-smathieu

    Joined:
    Dec 4, 2017
    Posts:
    4
    Thank you. Can we expect the fix for February or March?
     
  26. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Probably not before the end of March.

    If possible, could you please provide us with more info on your workflow with the skinned meshes?
    e.g. do you model the character in Unity then bring it to Maya to skin? Do you export a placeholder (e.g. cube) then completely replace the mesh in Maya?

    Learning more about your workflow will help us to improve the exporter :)

    Best,
    Viktoria
     
  27. artintime

    artintime

    Joined:
    Feb 19, 2018
    Posts:
    1
    Hi, thanks for creating such a great plugin for Maya. I have an issue thou, I've tried every consivable way to install it but there is no entry in Maya's file drop down menu saying Unity with an icon. what am i doing wrong? i am using Maya 2018 and Unity 2017.3...
    Thanks for help.
     
  28. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi artintime,

    Thank you for the feedback.
    Do you get any error messages in Maya or in Unity when installing the plugin? If so could you please send them?

    Best,
    Viktoria
     
  29. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Maya 2018 integration installation fails for me :/ Attached logs. Using Unity 2018.1.0b4 and FBX Exporter v 1.2.0b1

    Steps:
    1. Open FBX Export Settings
    2. 3D Application = Maya 2018
    3. Click "Install Unity Integration"
    4. Maya starts, but never closes.
    5. The Maya > File menu doesn't show Unity > Import / Export item. The native 'Send to Unity' item is still there in the File menu.
    6. Unity never displays the completed installation message.
     

    Attached Files:

    Last edited: Feb 21, 2018
  30. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Found somewhat of a workaround. I was able to get the File > Unity > Import / Export UI to show up by:
    1. Unzipping UnityFbxForMaya.zip into D:\UnityFbxForMaya
    2. Adding the following line to my Maya.env file (e.g. C:\Users\Brad\Documents\maya\2018\Maya.env)
    MAYA_SCRIPT_PATH = D:\UnityFbxForMaya\Integrations\Autodesk\maya\scripts;
    3. Open Maya and run this Mel command in the script editor:
    unitySetupUI;

    Not sure the full setup is complete though..

    On a related note, most modern art pipelines use Python or Pymel in Maya. Any particular reason these tools are written in Mel? I have my own custom Pymel pipeline that I'd like to integrate into these tools. To be blunt, as a tech artist, I'd never use these FBX Mel tools out of the box, and I'd guess most studios with pipelines wouldn't either. There's just too much customization involved. I'd rather see a Pymel implementation of these FBX tools that is written in an extensible and customizable way. I have my own methods for setting Unity project paths, filenames, baking animations, using FBX presets for different kinds of assets, etc. What I mainly need is an extensible Python based way to pass whatever meta data is required to maintain connections between the FBX nodes and Unity components.
     
  31. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Hmm. So, it doesn't look like there is any meta data in Maya, aside from project and file paths. so you don't really need the Mel Import / Export commands to maintain component connections in Unity? I'm guessing that's all handled in the UnityFbxSdk.dll and Unity .meta files?
     
  32. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    So, it looks like all you need is to follow the first workflow you described to keep connections between and FBX and Unity components? No need to use the Mel Import / Export scripts in Maya?
     
    Last edited: Feb 22, 2018
  33. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    114
    Could you explain a bit more what the "restricted licence" means?
     
  34. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185

    Attached Files:

  35. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    While it's interesting to consider the possibilities of exporting models from Unity into Maya for prototyping, I would venture to guess devs are much more interested in more features supporting the traditional workflow of starting by creating assets in a DCC tool (Maya, Max, Blender) and exporting them into Unity. I would like to see the skinned mesh support issues prioritized, as cited by @atf-smathieu and @jschroyen. Generally, I think it's best to first get the workflow from DCC → Unity rock solid (i.e. where the prefab auto updates cleanly when a new FBX is imported and keeps components on the FBX). After that, it's interesting to consider the Unity → DCC workflow, IMO.
     
  36. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi Brad,

    Thank you for providing the logs.

    I don't see any clear installation errors. If you go into the "C:/Users/{username}/Documents/maya/modules" folder, is there a file called "UnityFbxForMaya.mod" containing the path to the Integrations folder that was unzipped during installation?

    For step 4, do you have "Keep Open" option checked? If so, it's normal that Maya will not close after installation.

    Thank you for providing the workaround. If you skip steps 1 and 2, and only do the 3rd step (running unitySetupUI in Maya), does it give an error?

    The reason the tools are written in mel is to support Maya LT, which does not have python/pymel support.

    You're right that the Maya plugin is not necessary for maintaining the connection between the FBX nodes and Unity components.
    This connection is maintained using the FbxPrefab component on the prefab that is linked to the fbx. No meta files are used/modified for the connection.
    In addition, the matching fbx nodes and Unity objects must currently have the same name in order to be updated correctly.

    Exactly, either the first or second workflow will maintain the connection.

    Thank you for the feedback!

    Best,
    Viktoria
     
  37. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi popMark,

    The restricted license requires that you click through and accept the Unity 2017.1 EULA.
    In addition, the FBX exporter package will only run in the Unity editor.

    Best,
    Viktoria
     
  38. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Thank you, really appreciate the feedback! I'll take note of your suggestions.

    Best,
    Viktoria
     
  39. atf-smathieu

    atf-smathieu

    Joined:
    Dec 4, 2017
    Posts:
    4
    This is our workflow to test the script with skinned meshes :
    - We create a placeholder Game Object in Unity, save it as a prefab then convert it to a linked prefab instance.
    - the script exports a fbx containing the placeholder. We import it in our maya rig scene, then we add all the joints and skinned meshes in the export set. We reexport it back to Unity.
    - Unity reloads it. We then have to manually set the Animation type to "generic "on this fbx, because the script left it on "none" . The skinnedMeshRenderer appears on the skinned meshes, but it has no visible effect (no deformation)
    - Then we apply various component on the prefab : rigidbodies, cloth, capsules, etc...
    - From now on, after each export the fbx seems to be properly updated , and the components are still in the prefab, but the skinned mesh renderer has no visible effect.
     
    vkovec likes this.
  40. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Viktoria,
    Thanks very much for the clarification. I think it would be nice if the docs had this kind of detail in them, and focused first on describing the traditional workflow of going from DCC -> Unity, since that's what most people are probably interested in.

    "I don't see any clear installation errors. If you go into the "C:/Users/{username}/Documents/maya/modules" folder, is there a file called "UnityFbxForMaya.mod" containing the path to the Integrations folder that was unzipped during installation?"

    Yes

    "For step 4, do you have "Keep Open" option checked? If so, it's normal that Maya will not close after installation."

    Yes. That makes sense now.

    "Thank you for providing the workaround. If you skip steps 1 and 2, and only do the 3rd step (running unitySetupUI in Maya), does it give an error?"

    That worked! The File menu -> Unity menu appears now.

    "The reason the tools are written in mel is to support Maya LT, which does not have python/pymel support."

    Ugh... I've brought this up with Autodesk before. Without file referencing for referencing rigs into animation scenes, and without Python, Maya LT is basically a modeling package, not the game dev tool they are marketing it as.
     
    Last edited: Feb 23, 2018
  41. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Yes I agree that would be helpful to add to the docs, will add a task for this.

    Do you have a custom userSetup.mel script in your " C:/Users/{username}/Documents/maya/scripts" or " C:/Users/{username}/Documents/maya/{version}/scripts" folders?

    Currently we add the call to "unitySetupUI" in the userSetup.mel file in "Documents/maya/scripts" on installation.

    However, if you also have a userSetup.mel script in the "Documents/maya/{version}/scripts" folder for the version of Maya you are using, then userSetup.mel in "Documents/maya/scripts" will not run.
    In this case the UI will not be added. The current fix is to add the following line to your Maya version specific userSetup.mel file:
    Code (csharp):
    1.  
    2. if(`exists unitySetupUI`){ unitySetupUI; }
    3.  
    This is a known issue that we plan to fix for a future release.

    Best,
    Viktoria
     
    tnydwrds likes this.
  42. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    I do indeed have a custom userSetup.mel. It's in a separate directory where I keep my python and mel scripts in Git. I source this directory in C:\Users\Brad\Documents\maya\2018\Maya.env
     
  43. Ritchie-J

    Ritchie-J

    Joined:
    Feb 26, 2018
    Posts:
    26
    I’ve imported an OBJ file, with no UV mapping, from another application into Unity.
    I’ve then exported the FBX manually via ‘Export model . . .’ from the ‘Game Object’ menu and it appears to have assigned a default set of UVs to the mesh.
    Whilst the seams are arbitrary it suits my purpose as I’m using textures with a consistent, small pattern scale.

    Is there any way of experimenting with the FBX mapping type directly via a Unity C# script?
    I’ve tried the FbxExporters.Editor.ModelExporter.ExportObject(. . . , . . .) function but the mesh is exported without UVs
    If anyone could indicate how to setup the export values in a Unity script I would very much appreciate it.
    (I’ve looked at the ‘Unity FBXSDK C# API Reference’ but not quite sure where to begin)
     
  44. MateoStj

    MateoStj

    Joined:
    Jun 21, 2017
    Posts:
    1
    Hi, i was wondering if I can call exporter from script? I need automated export after some tasks
     
  45. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Yes that's likely the reason the UI is not loading. Have you tried adding the following line of code into your custom userSetup.mel:
    Code (csharp):
    1.  
    2. if(`exists unitySetupUI`){ unitySetupUI; }
    3.  
    Until we fix the issue, this will load the UI automatically without having to run unitySetupUI manually each time.

    Best,
    Viktoria
     
    Last edited: Feb 27, 2018
    tnydwrds likes this.
  46. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi Ritchie-J,

    Do you see the default UV set on your OBJ object before export? If so, it's possible Unity is assigning default UVs on import of your OBJ file.

    Otherwise I'm not sure where the default UVs would be created as the FBX exporter doesn't modify the UV mapping or generate one. It exports the UVs as is or none if no UVs have been set.

    To modify the UVs before export, you can set the UVs on the mesh through scripting.
    More details on setting the mesh UVs can be found here: https://docs.unity3d.com/ScriptReference/Mesh-uv.html

    Best,
    Viktoria
     
  47. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi MateoStj,

    Yes in order to export from script you can call one of the following:
    Code (csharp):
    1.  
    2. // exports a single object hierarchy, returns the export path.
    3. FbxExporters.Editor.ModelExporter.ExportObject(string filePath, UnityEngine.Object root);
    4.  
    5. // exports given list of objects or current selection if no objects given, returns the export path.
    6. FbxExporters.Editor.ModelExporter.ExportObjects(string filePath, UnityEngine.Object[] objects = null);
    7.  
    Best,
    Viktoria
     
  48. Ritchie-J

    Ritchie-J

    Joined:
    Feb 26, 2018
    Posts:
    26
    Hi Viktoria,

    Thanks for response!
    Absolutely no UVs on the OBJ or initially when dropped into Unity’s Asset Folder.
    However, I’ve found the reason for the anomaly and describe here it for future reference:-
    1. I wrote a script to output the length of the Mesh UV Vector2[] arrays – uv, uv2, uv3, uv4.
    2. When attached to the Scene View object it output a value of 0 for all four of them in Play mode.
    3. I then enabled ‘Generate Lightmap’ in the Inspector and ran the test in the Scene View again.
    4. This time round it indicated that uv2 had been assigned values and the rest were still 0.
    5. Using a material with the Standard Shader I assigned the texture to the Secondary Map’s Detail Albedo.
    This uses ‘UV1’ (equivalent to uv2) by default. The texture then showed correctly.​
    6. After amending the script to copy uv2’s values to uv everything was fine.
    7. The reason the FBX export ‘worked’ was that it automatically assigned the uv2 values to uv and then set the former to 0.
    Yes, but non-trivial on a complex object – the Unity Docs example just deals with a simple plane.
     
    Last edited: Feb 28, 2018
  49. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Thank you for the detailed explanation, that's really interesting. Currently we export only the UV sets that are not empty, but maybe we should be exporting the empty UV sets as well so that when you import it back into Unity they are assigned to the same UV set as before.

    You're right it's not ideal for a complex object. I'm not aware of another way to set the UVs in Unity, but have you tried any packages from the asset store to unwrap UVs? For instance, ProBuilder provides a UI for unwrapping UVs.

    Best,
    Viktoria
     
  50. Ritchie-J

    Ritchie-J

    Joined:
    Feb 26, 2018
    Posts:
    26
    Hi Viktoria,
    Maybe best – either way good to clarify current procedure in accompanying User Guide PDF.
    Indeed, I use it together with Blender for accurate custom UV maps –
    However, the ‘Lightmap’ option, now that I understand it, is ideal for rapid iteration before final design is settled.
     
    vkovec likes this.
Thread Status:
Not open for further replies.