Mock AR Device for in-Editor Simulation

We’ve been working on a new package that allows for in-Editor simulation of ARFoundation via a mock AR device. It’s finally ready for you to try.

I’ve added a sample scene to the ARFoundation Samples github repo. It’s in a separate branch, since it relies on a new package that hasn’t been tested extensively. There’s a scene called “MockExample” that runs in the Editor. There’s an API for supplying data to the mock device, such as planes and feature points.

This is very early stuff, and we’ll be updating it soon. It should allow for much faster iteration within the Editor, so I hope you find it useful!

-Tim

6 Likes

Is this new / experimental package available via the Package Manager? Or is it currently only contained in that specific branch in the sample repo?

It is a package; the sample repo contains several scripts showing its use. It’s not production quality yet, so you have to do some dances with the package manifest to obtain the package (the samples repo is already setup appropriately).

Thank you, I was able to get the package in my project following the sample repo’s manifest file as an example!

I just gave the preview package a go, but I am facing some compile errors for iOS:

There seems to have sneaked in a compile error, a mistakenly placed ‘c’, at then end of EditorRemoting.cs #if UNITY_IOS clause. (line 606).

There is missing an using 'UnityEditor.Hardware' in order for the EditorRemoting.cs to compile the DevDeviceList

So I am a bit unsure how this actually works. Is the mock just a remote connection to a mobile device using the Unity Remote app? Or is the mock some sort of build-in editor tool that enables you to ‘fake’ AR within editor?

@Freaking-Pingo This is not a “remote” for testing. As your 2nd statement says, it’s a in editor “mock” tool for testing AR inside of the Unity editor without having to build to device.

Thanks for reporting! Will get it fixed asap.

EDIT: ARRig script is called ‘Scaler.cs’ in the Mockup scene :slight_smile:
Looking forward to iOS build so can test :slight_smile:

Just encountered iOS built error also.

Is it possible to get this demo scene because i’m unable to figure out how to rebuilt it from AR Foundation and the mock scene?
Perhaps i’m stupid but it doesn’t seem very intuitive. For eg, demo has ARRig script but sample scene nor Mockup doesn’t.

The “ARRig” in that screenshot is now called “ARSessionOrigin” and all scenes in the sample repo should have this.

The mock example also has a “scaler” script (all it does is set the transform’s localScale). The only difference between the gdc demo and the mock example is a the content is a blue cube instead of a village scene.

Also, the iOS build error hah been fixed but you’ll need to update the package to get the fix (the repo still points to the older package). Also note that the mock doesn’t run on iOS so this is only an error if you happen to set the current build platform to iOS.

Got scaling working in editor (see vid below) but fails when built to device (see 2nd vid, am scaling with finger) Any ideas?

Working in Unity using simulation mode (this is cool!)

https://vimeo.com/290614543

Not working when built to iPhone:

https://vimeo.com/290615064

Only edit I made was to the Scaler script - adding a method and then connecting the slider to it.

public class Scaler : MonoBehaviour
    {
        [SerializeField]
        float m_Scale = 1f;

        void Update()
        {
            transform.localScale = Vector3.one * m_Scale;
        }

        public void AdjustScale(float newScale)
        {
            m_Scale = newScale;
        }

Are you able to please share your version which works or advise what’s going wrong?
Thanks

Hi guys.

I just tried to work with this, but I got this error when I switch to iOS Devices:

/Users/tonymunoz/Library/Unity/cache/packages/staging-packages.unity.com/com.unity.xr.mock@0.0.1-preview.6/com.unity.xr.remoting/Editor/EditorRemoting.cs(615,13): error CS1002: ; expected

I tried to find EditorRemoting but I couldn’t.

Any suggestions?

@tdmowrer We’ve noticed some major memory leaks occurring in our app that uses ARFoundation with ARKit. As we’ve tried to track where this leak is occurring, I’m noticing that if I simply run the MockExample scene in the Unity Editor and leave it running, that the total allocated memory continuously grows and grows. I started at 0.66GB total allocated, and after about 5 minutes was up to 1.17GB.

Perhaps there is a memory leak in ARFoundation??

I had this error when my build platform was set as iOS, you need to have it set as Standalone.

1 Like

Thanks. It seems that this library has a long way to go.

1 Like

ARFoundation Test

9 Likes

@rxmarccall_1 Could you let me know what version of Unity are you currently using ?

Hi! I tried to open the ARFoundation Sample project in mock branch, when I open the project (either in Standalone or in Android) I get the following error:

C:/Users/fiorenti/AppData/Local/Unity/cache/packages/staging-packages.unity.com/com.unity.xr.mock@0.0.1-preview.6/com.unity.xr.remoting/Runtime/RemoteScreenComponent.cs(12,16): error CS0246: The type or namespace name AsyncGPUReadbackRequest' could not be found. Are you missing UnityEngine.Experimental.Rendering’ using directive?

Do you have some idea to fix it?
Thank you.

Update: I get the same error also in iOS!

Daniele

@DanieleFiorenti What’s the version of Unity you are using ?