Unity, Attempt to access method 'SFB.IStandaloneFileBrowser.OpenFilePanel' on type '' failed

36 Views Asked by At

I'm using StandaloneFileBrowser package in order to load local 3d model to runtime. The file loading event is designed to be triggered by a button. It works fine only in Unity if I click play. But after I built it and run the builded software, I've got "Not implemented: Class::FromIl2CppType" and "MethodAccessException: Attempt to access method 'SFB.IStandaloneFileBrowser.OpenFilePanel' on type '' failed."

Following are the code that execute the load.

string[] objPath = StandaloneFileBrowser.OpenFilePanel("Select Folder", "", extensions, true);
FileLoader fileLoader = new FileLoader();
fileLoader.LoadObjFromFile(objPath[0]);

Then the code below will be called.

public void LoadObjFromFile(string objPath) {
    if (!File.Exists(objPath))
    {
        Debug.Log("File doesn't exist.");
    }else{
        if(loadedObject != null)            
            Destroy(loadedObject);
        loadedObject = new OBJLoader().Load(objPath);
    }
}

I have tried build with both windows and webgl, none of them worked. I have googled about the problem and does not find similar issue.

0

There are 0 best solutions below