Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

ARCore with UnityRemote and the Device Camera

Discussion in 'ARCore' started by fractalsynapse, Mar 31, 2018.

  1. fractalsynapse

    fractalsynapse

    Joined:
    Aug 11, 2013
    Posts:
    2
    Hi Friends,

    I am embarking on AR development and very excited about it. I am hitting a wall here though and think some code may need hacking to make Unity Remote use the Android Camera in the unity editor.

    I have an S8 and the 2017.3.1f1 Personal Unity edition. Project is the simple ARCore HelloAR.

    After fighting with the setup and tools fiasco, and fixing C# errors that spawn errors... I was able to build and deploy an APK.

    Device Install worked. I was able to find surfaces and plant the little droid on surfaces. YAY!.

    NEXT : Workflow, I can't possibly build an app having to deploy an APK each time to test a few lines of code. This is where I saw on youtube "Unity Remote 5" from the Pirates AR dude. PERFECT!

    So I installed and made the platform changes for the Editor to "Any Android Device"

    THE RESULT:
    ---------------------------

    Unity Remote shows what appears to be only the unity camera view. The solid blue background with the UI Label at the bottom that says "Searching for Surfaces"

    *yes permissions were accepted at the start, and Unity Remote re-installed.
    ----------------------

    I had a look at the ARCoreBackgroundRenderer.cs and placed a debug message which is stating that when we run that it never gets a texture to set. This tells me that likely the only thing not happening is the Camera is not being used or an access / code select issue or bug.

    Code (CSharp):
    1.  
    2.  
    3. private void Update()
    4.         {
    5.             if (BackgroundMaterial == null)
    6.             {
    7.                 Disable();
    8.                 return;
    9.             }
    10.  
    11.             Texture backgroundTexture = Frame.CameraImage.Texture;
    12.             if (backgroundTexture == null)
    13.             {
    14.                 [B]Debug.Log("backgroundTexture is null");       //the line I added[/B]
    15.                 Disable();
    16.                 return;
    17.             }
    18.  
    19.     // This is just a snippet of the top of the update function
    20.  
    21.  
    22.  

    ---------------------

    So I'll try to dig deeper but right now the question is: Why is Unity Remote 5 getting null from Frame.CameraImage.Texture?

    When I run from the Editor , I get the blue solid background with the "searching for surfaces" message on both the android device and the editor. I expect to see the Android camera as the background and image processing source.

    Is there a mix up in the ADB device ports? does the video flow on different ports? how can I test / troubleshoot this?

    I attached an image as well, you can see the stream of my log message. unityremote.png

    THX!
     
  2. fractalsynapse

    fractalsynapse

    Joined:
    Aug 11, 2013
    Posts:
    2
    OK I got it. What I did was downloaded the latest master from ARCore github. My intution about some of the LifecycleManager changes to make it run in the first place were possibly occurring.

    Download the master branch zip here https://github.com/google-ar/arcore-unity-sdk

    extract it. then copy it to your project assets folder and overwrite the previous GoogleARCore folder.

    Now when you hit play on the editor, it may ask you something NEW. Like "Would you like to install ARCore Instant Preview?" CHOOSE "HELL YEAH!"

    Bang it works - finally :)

    unitywin.png
     
  3. RegisVe

    RegisVe

    Joined:
    Mar 2, 2018
    Posts:
    9
    Hi, I'm on macOS, having the same issue. Updating ARcore doesn't seem to fix it for me though.
     
  4. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    36
    i try with Unity 2017.4.5f1 (64-bit) and the github but the arcore istant preview not work