Zephyrnet Logo

How to build ARCore Cloud Anchor Sample for Unity

Date:

Main problem that I’ve encountered is that there are several moving cogs in this endeavour:

  • Unity3D 2019.4.x
  • AR Foundation package
  • ARCore XR Plugin package
  • ARCore Extensions with Sample

Current version of ARCore Extensions is 1.17.0. Inside of it’s repository you can find Cloud Anchor Sample project. To build it, documentation states that you should use

“AR Foundation package version 3.1.0.

ARCore XR Plugin package version 3.1.0.

You may encounter compatibility issues if you do not use these versions.”

Pretty clear right? NOPE.

There are bunch of those 3.1.x versions:

Travolta.gif

This is a tricky part. ARFoundation has older stable 2.1.4 version. There is also 3.1.3, and bunch of preview 3.x and 4.x versions. But not all versions of ARCore Extensions and ARCore plugin work with each other.

Which one should we use? Apparently what they mean is preview.6 — 3.1.0. Not the latest preview.X — 3.1.0, nor the stable 3.1.3.

This basically sums up the article, use preview.6–3.1.0.

But let’s proceed and go through entire process anyway.

  • Create new project or Open an existing one

Note: URP (Universal Render Pipeline) is not supported

These instructions are taken from official google documentation

  • Switch Platform to Android
  • Uncheck Auto Graphics API. If Vulkan is listed under Graphics APIs, remove it (Player Settings > Other Settings > Rendering)
  • Android 7.0 “Nougat” (API Level 24) or higher (Player Settings > Other Settings > Minimum API Level)

1. Designing for a modern 3D world: A UX design guide for VR

2. Scripting Javascript Promise In Spark AR For Beginners

3. Build your first HoloLens 2 Application with Unity and MRTK 2.3.0

4. Virtual Reality: Do We Live In Our Brain’s Simulation Of The World?

Note: For AR Optional apps, the Minimum API level is 14

Time to move to package manager.

Make sure that you’re able to see preview packages.

Check the “Show preview packages”
  • Install ARCore XR Plugin. By default it will set the older version of it.
  • Install ARFoundation Plugin
  • Install latest Multiplayer HLAPI package
  • Change both versions to preview.6–3.1.0
  • Go to https://github.com/google-ar/arcore-unity-extensions/releases and download the latest 1.17.0 version.
  • Extract the downloaded archive to a local folder

Make sure it’s a location that is convenient — after you install the package into your project, you won’t be able change the folder’s location or contents without first uninstalling the package. You may reinstall the package after changing the folder location

  • Click on “Add package from disk” and navigate to the location of extracted folder
  • Select package.json
  • This local package will appear as ARCore Extensions package. Select it from the list and click “Import Into Project” on Cloud Anchor Sample
  • Add The scene from the sample to the “Scenes in Build”

Note: Unity emphasizes everywhere that multiplayer service is deprecated. however the matchmaking will be available till 2022. More Info here: https://support.unity3d.com/hc/en-us/articles/360001252086-UNet-Deprecation-FAQ

  • Now we have to bind local project to Unity Project ID
d
  • After creating new ID or linking it to existing one, navigate to the end of the services list.
  • Click on Multiplayer
  • Click “Go to dashboard” and setup Unity Multiplayer. You just have to specify maximum number of users per room
First time setup of Unity Multiplayer

In order to use the ARCore Cloud Anchors, you’ll need an Google Cloud API Key.

  • Create new project
  • Click “Enable APIs and Services”
  • Search for “ARCore Cloud Anchor API” and enable it
  • Navigate to Credentials panel and create API key
  • It’s a good approach to restrict the key only to the APIs we’re planning to use it for. In this case just select “ARCore Cloud Anchor API”
  • After obtaining API key, switch back to Unity project. Navigate to Edit > Project Settings > XR > ARCore Extensions and add it to Cloud Anchor API Keys.
  • Build and run the project on your device!

This flow was tested for Android build, but ARCore supports iOS devices as well. If you’re targeting iOS, be sure to tick “iOS Support Enabled” at Edit > Project Settings > XR > ARCore Extensions.

This article is mix of personal experience with official documentation. Some instructions are just quotes from official sources.

Working combination of versions:

  • Latest Unity 2019.3.x/2019.4.x
  • ARFoundation preview.6-3.1.0
  • ARCore preview.6-3.1.0
  • ARCore Extensions 1.17.0

That’s it, have a nice Day!

Source: https://arvrjourney.com/how-to-build-arcore-cloud-anchor-sample-for-unity-c2c4e8046f84?source=rss—-d01820283d6d—4

spot_img

Latest Intelligence

spot_img

Chat with us

Hi there! How can I help you?