Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Draco plugin won't work from non main thread?

Discussion in 'Android' started by trackOfer, Jan 20, 2019.

  1. trackOfer

    trackOfer

    Joined:
    Dec 27, 2017
    Posts:
    9
    I tried to integrate the Draco mesh loader library into my Unity app.
    https://github.com/google/draco

    The plugin works on both the main thread and the non main thread on the desktop.
    On Android it works on the main thread, but not on the non main thread.
    This is also after I removed any initialization of Unity Classes such as Mesh so it won't fail on that on the non main thread.

    Is there a limitation in Unity to use binary Android plugins outside the main thread?
    There doesn't seem to be any error on LogCat, the failure is also once I call the external plugin function. If I remove that function form the code, it continues, otherwise the script crash there.
    No error for the crash as well.
     
  2. atti

    atti

    Joined:
    Feb 22, 2011
    Posts:
    102
    Try my optimized fork:

    https://gitlab.com/atteneder/DracoUnity

    Benefits:

    • Can be integrated into Projects easily via Package Manager
    • Is magnitudes faster due to
      • Bulk memory copies instead of per vertex/index data copy
      • Multi-threaded via C# Job system
    • Supports single meshes with more than 65536 vertices (old split algorithm was broken)
    • Corrects tangents by re-calculating them if necessary
    • Additional native libs and support for platforms
      • WebGL
      • iOS armv7(s) and arm64
      • Windows 32-bit
      • Linux 64-bit and 32-bit
      • Android x86

    Google also endorses it.

    hth,
    atti
     
  3. Emrys95

    Emrys95

    Joined:
    Sep 7, 2018
    Posts:
    3
    I'm trying to use your Draco fork for Unity and can't even get the sample project running.
    You have one benchmark obj which then tries to decode a draco mesh which is already included and set up. However, even that fails with the error Failed: Decoding error. On line 109 DracoMeshLoader.cs. Any tips on how this can be fixed/used? How about using Draco to actually Encode a mesh, could you give us more details about that?
     
  4. atti

    atti

    Joined:
    Feb 22, 2011
    Posts:
    102
    Currently it's hard for me to find time for support, but you can help by creating an issue in the original project page with details on your setup.
    Thanks
     
unityunity