Unable to use a native android plugin for Unity

♀尐吖头ヾ 提交于 2020-01-07 05:22:32

问题


I wish to use this native plugin for Android devices via Unity. For some reason the plugin is just now working. When I run it on a real device the game crashes. I am using Unity 5.5.2f1 personal, my phone is Samsung Edge 6 with Marshmallow api.

I have placed the jar file inside Assest/Plugins/Android. I can't figure out what is the cause for this error. Do you know what is wrong here?

This is part of my code:

 private AndroidJavaObject plugin;

void Start ()
{
    plugin = new AndroidJavaClass("jp.kshoji.unity.sensor.UnitySensorPlugin").CallStatic<AndroidJavaObject>("getInstance");

    //Init the ambienttemperature sensor
    if (plugin != null) 
    {
        plugin.Call("startSensorListening", "ambienttemperature");
    }

}

来源:https://stackoverflow.com/questions/42747522/unable-to-use-a-native-android-plugin-for-unity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!