Search Unity

Autodesk.fbx build errors for Windows

Discussion in 'Windows' started by Zipp, Jul 26, 2019.

  1. Zipp

    Zipp

    Joined:
    Dec 27, 2012
    Posts:
    13
    Hello,

    the FbxExporter package from Unity gives the possibility to export GameObjects as FBX files. According to the documentation this is also possible at runtime when implementing the exporter completely using Autodesk.Fbx (the autodesk fbx sdk).

    I achieved now to successfully export the models in the editor. However, when I try to build the application as a Windows Standalone x64, I always get the following error:

    Assets\StandardAssets\FbxExport.cs(5,7): error CS0246: The type or namespace name 'Autodesk' could not be found (are you missing a using directive or an assembly reference?)

    According to the following link it also should work in the build as well:
    https://docs.unity3d.com/Packages/com.unity.formats.fbx@2.0/manual/devguide.html

    Can anybody help me? I already looked into some files of the Autodesk package and I found the NativeMethods.cs script where one can specify the DllImportName as following:

    Code (CSharp):
    1. #if UNITY_EDITOR_OSX
    2.   const string DllImportName = "Packages/com.autodesk.fbx/Runtime/Plugins/x86_64/UnityFbxSdkNative.bundle/Contents/MacOS/UnityFbxSdkNative";
    3. #elif UNITY_EDITOR_LINUX
    4.   const string DllImportName = "Packages/com.autodesk.fbx/Runtime/Plugins/x86_64/UnityFbxSdkNative.so";
    5. #elif UNITY_EDITOR_WIN
    6.   const string DllImportName = "Assets/Autodesk/Plugins/x86_64/UnityFbxSdkNative.dll";
    7. #elif COM_UNITY_FORMATS_FBX_AS_ASSET || UNITY_STANDALONE
    8.   const string DllImportName = "UnityFbxSdkNative";
    9. #else
    10. #error "FbxSdk: C# bindings for this platform haven't been implemented yet, sorry."
    11.         const string DllImportName = "UnityFbxSdkNative";
    12. #endif
    13.  
    14.  
    One can see, that also the UNITY_STANDALONE is supported. I have tried to set a correct path to the dll here, but this did not change anything.

    Thanks for any help!
     
  2. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    158
    Hi @Zipp ,

    You shouldn't need to change the path in NativeMethods.cs.

    This looks like an issue with the FBX SDK assembly file being set to editor only. Until we fix this issue, here is a workaround:

    1. Locate the Autodesk.Fbx.asmdef file under packages
    upload_2019-7-26_14-33-5.png

    2. Right click and select "Show in Explorer" option
    upload_2019-7-26_14-34-8.png

    3. In the explorer right click on the Autodesk.Fbx.asmdef file and select "Properties"
    4. In the properties make sure "Read Only" is unchecked
    upload_2019-7-26_14-35-16.png

    5. Open the file in a text editor and under "includePlatforms" remove the word "Editor" and save

    Code (csharp):
    1.  
    2. {
    3.     "includePlatforms": [
    4.         "Editor"
    5.     ],
    6. }
    7.  
    Now if you go back to Unity you should be able to build the project.

    Let me know if this doesn't fix the issue.

    Best,
    Viktoria