LoginSignup
68
58

More than 5 years have passed since last update.

ARCoreをPixelやS8以外の端末で動かす

Last updated at Posted at 2017-08-31

8/30GoogleARCoreTango使ARSDK
previewPixelPixel XLGalaxy S8使

This device does not support ARCore.


PixelTangoZenFone ARPhab 2S8Daydream


ARCoreNexus6PAndroid7.1.2()
Windows10 x64 ProUnity2017.2.0b9



https://developers.google.com/ar/develop/unity/getting-started

Android SDK


AndroidSDKAPI24
AndroidStudioSDK ManagerAPI24 Build Tools

Unity


Unity2017.2.0b9
Android Build Support()
Unity
Unity使
(Unity2017...)

ARCore SDK for Unity


Github

ARCore Service


ARCore Service


Unity3D
HelloAR


Aseets > Import Package > Custom Package 
arcore-unity-sdk-preview.unitypackage


ProjectAseets > GoogleARCore > HelloARExample > Scenes HelloAR


File > Build Settings Build Settings
PlatformAndroidSwitch Platform

Add Open Scenes
HelloAR

Player Settings
Inspector


Other Settings > Multithreaded Rendering 

Other Settings > Package Name com.example.helloAR

Other Settings > Minimum API Level Android 7.0

Other Settings > Target API Level Android 7.0

XR Settings > Tango Supported 


Build SettingsPC(USB)Build And RunThis device does not support ARCore.

ARCore


This device does not support ARCore.HelloARController.cs_QuitOnConnectionErrors
HelloARController.cs
private void _QuitOnConnectionErrors()
{
    // Do not update if ARCore is not tracking.
    if (Session.ConnectionState == SessionConnectionState.DeviceNotSupported)
    {
        _ShowAndroidToastMessage("This device does not support ARCore.");
        Application.Quit();
    }
    ...
}

Session.ConnectionState が SessionConnectionState.DeviceNotSupported になると上記エラーを出力するので、SessionConnectionState.DeviceNotSupportedを設定しないようにする。

SessionConnectionState.DeviceNotSupportedを設定しているのは、SessionComponent.csのConnectメソッドのisSupportedを見ている個所のようだった。
このif文をまるごとコメントアウトして保存する。

SessionComponent.cs
public AsyncTask<SessionConnectionState> Connect(SessionConfig sessionConfig)
{
    ...

    bool isSupported;
    ApiServiceErrorStatus status = TangoClientApi.TangoService_IsSupported(out isSupported);
    if (status.IsTangoFailure())
    {
        ARDebug.LogError("There was an error accessing the ARCore API.");
        SessionManager.ConnectionState = SessionConnectionState.ConnectToServiceFailed;
        return new AsyncTask<SessionConnectionState>(SessionManager.ConnectionState);
    }
    //if (!isSupported)
    //{
    //    ARDebug.LogError("Device does not support ARCore.");
    //    SessionManager.ConnectionState = SessionConnectionState.DeviceNotSupported;
    //    return new AsyncTask<SessionConnectionState>(SessionManager.ConnectionState);
    //}

    ...
}

Build SettingsBuild And Run

21167564_1495173297231596_3470961843718315641_o.jpg
Nexus6Ppreview

68
58
8

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
68
58