Search Unity

Autodesk.fbx build error

Discussion in 'External Tools' 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. saulth

    saulth

    Joined:
    Mar 20, 2015
    Posts:
    17
    Just had this problem too. Fixed by copying the "com.autodesk.fbx@2.0.1-preview.1" folder to my Assets folder, then uninstalling the FBX Exporter package. Once that is done the problem still exists, so in the project click on the "com.autodesk.fbx@2.0.1-preview.1/Runtime/Autodesk.Fbx.asmdef" and tick the "Windows 64-bit" option in "Include Platforms". Then the build should work. Note that I could not tick this box when the package was in the normal install location, so had to copy it into the Assets folder.
     
  3. Zipp

    Zipp

    Joined:
    Dec 27, 2012
    Posts:
    13
    Hello thank you for you reply,

    your hint with the Include Platforms option did the trick! :)