Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unity Input.gyro.enabled在Android上引发空指针异常_Android_Unity3d - Fatal编程技术网

Unity Input.gyro.enabled在Android上引发空指针异常

Unity Input.gyro.enabled在Android上引发空指针异常,android,unity3d,Android,Unity3d,我试着在安德里欧装置上使用统一的陀螺仪,它肯定有陀螺仪。但是,它使用空指针取消引用来保持SIGSEV'ng 来自墓碑:pid:8732,tid:8750,姓名:UnityMain>> com.DefaultCompany.SIGV您是否尝试过(Input.isGyroAvailable)?@zambari没有,但我刚刚尝试过,它说Input.isGyroAvailable已贬值,我应该使用SystemInfo.supportsGyroscope:) private bool EnableGyro

我试着在安德里欧装置上使用统一的陀螺仪,它肯定有陀螺仪。但是,它使用空指针取消引用来保持SIGSEV'ng

来自墓碑:pid:8732,tid:8750,姓名:UnityMain>>
com.DefaultCompany.SIGV您是否尝试过(Input.isGyroAvailable)?@zambari没有,但我刚刚尝试过,它说Input.isGyroAvailable已贬值,我应该使用SystemInfo.supportsGyroscope:)
private bool EnableGyro()
{
    if (SystemInfo.supportsGyroscope)
    {
        //gyros = Input.gyro; 
        //gyros.enabled = true;
        Input.gyro.enabled = true;
        /*
        cameraContainer.transform.rotation = Quaternion.Euler(90f, 90f, 0f);
        rot = new Quaternion(0, 0, 1, 0);*/
        return true;
    }

    return false;
}