Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Native plugin not working on Windows and Android

Discussion in 'Unity 5 Pre-order Beta' started by AndreasSommer, Nov 7, 2014.

  1. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    Our native plugin is not working on both Windows and Android (didn't want to lose any more nerves by trying OSX and iOS).

    Using Unity 5.0.0b12 for Windows, but also happens for the "stable" 5.0.0b9.

    Windows
    Our 32-bit DLL doesn't work with the 64-bit editor (DllNotFoundException, our DLL is in "Assets\Plugins"). Fair enough, we can handle that. The DLL can be found and loaded with the 32-bit editor, so I gave that a shot.

    Now I have the horrible problem that neither UnitySetGraphicsDevice nor UnityRenderEvent are called (of which I can be 100% sure). Other C functions inside our DLL can be called from C# code using [DllImport("mydllname", CallingConvention=CallingConvention.Cdecl)] without any issues, but the essential two callbacks are not being called by Unity. I also tried the names "
    __UnitySetGraphicsDevice__" (as documented) and "_UnitySetGraphicsDevice" (extra underscore at beginning), but none of them worked.

    Please tell me how to fix that. Or even better, tell me it's a bug that you will fix ;)

    Android
    On Android, I can deploy to a device like normal, but then the dependency of our .so file (here: libavutil.so) cannot be found. The project and its folder structure works perfectly fine in Unity 4.x.

     
  2. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    did you click all plugins and set the options in inspector? also from upgrade guide:

    Native Plugins in the Editor
    32-bit native plugins will not work in the 64-bit editor. Attempting to load them will result in errors being logged to the console and exceptions being thrown when trying to call a function from the native plugin. To continue to use 32-bit native plugins in the editor, use the 32-bit editor version (provided as a separate installer). To have both 32-bit and 64-bit versions of the same plugin in your project, simply put them in two different folders and set the supported platforms appropriately in the importer settings.

    Restrictions:
    We currently do not provide a 32-bit editor for OSX.
     
  3. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    it even happens with x32 versions too, i mean with x32 plugin, and x32 unity
     
  4. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    @Ostwind can you tell me what you mean by "click all plugins and set the options in inspector"?

    As said, our plugin is working fine in Unity 4.x, and the 32-bit/64-bit difference is clear to me, but doesn't change anything unfortunately.
     
  5. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Use the new plugin inspector. You can search for it in the local documents. When you click a dll you can set it's platforms in the inspector window.
     
  6. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    I deleted all non-Windows plugin binaries (just to be sure) and set the Windows variant to x86-only for Editor/Standalone. Still not working unfortunately, but good hint.
     
  7. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I think you need to submit a bug report with your project included.
     
    shkar-noori likes this.
  8. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    Doing that right now, thank you for your help!
     
  9. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    No response from the Unity team. Also not to other Unity 5 issues. I have a bad feeling about this release...
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,658
    Case number?
     
  11. AndreasSommer

    AndreasSommer

    Joined:
    Mar 5, 2013
    Posts:
    11
    647010

    Thanks for having a look!
     
  12. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,658
    Answered to you in the bug, you should receive an email