Build Native Plugins

Hello, I've bought the PDFViewer asset from the Unity store to show PDF inside in device, but I've encountered a problem.

When the PDFViewer C# script calls a Native function the whole script blocks without any error message.

This is the code that calls the native function NativeMethods.FPDF_InitLibrary();

public void EnsureNativeLibraryIsInitialized(){
    lock (PDFLibrary.nativeLock){
        if (!m_IsLibraryInitialized){
            NativeMethods.FPDF_InitLibrary();
            m_IsLibraryInitialized = true;
        }
    }
}

and this is how the native function is defined

...
[MethodImpl(MethodImplOptions.Synchronized), DllImport(PDFLibrary.PLUGIN_ASSEMBLY)]
public static extern void FPDF_InitLibrary();
...

Searching online I've found this guide that tells to Build Native Plugins to make the third-party libraries to work. But the guide refers to clicking on Magic Leap > Build Native Plugin which is not present in my Unity version. These are the only options available on my PC:
image

The PDFViewer asset has a folder inside called Plugins where there are some compiled files, does this have anything to do with the problem? This is the folder structure:

Unity Editor version: 2022.2.20f1
ML2 OS version : Version 1.4.0-dev2 - Build B3E.230907.10-R.033 - Android API Level 29
MLSDK version: 1.11.0
Host OS: Windows 11

Hi @PPXR,

What do you mean by this more specifically?

Best,

El

Means that when the program executes the line NativeMethods.FPDF_InitLibrary(); stop but don't crash. Therefore when I place for example a Debug.Log("...") function before and after that line only the first one is printed.

Best
PPXR

When I looked at the guide you posted I did not see reference to the Build plugin menu option. However, we may be looking at side versions of the documentation. The Build Plugin Option was visible when using the Magic Leap 1 SDK since it used a custom OS. Magic Leap 2 runs Android, so plugins should be built using the standard Android tools and workflows.

Regarding the plugin not working as expected, this might be due to an issue with the plugin that is included in the plugin . Here is a link to a post I made about getting the plugin to work on Magic Leap 2 : Using the PDF Renderer from Paroxe