Skip to Content
Quick StartUnity Package

Unity Package

Graffity AR Cloud for Unity localizes the device against a Graffity map (VPS) and aligns the content you author in your Unity scene to the real world. Continuous re-localization keeps the content aligned, and AR navigation guides players across map sections. Its names and behavior follow the iOS SDK. Your scenes and scripts own all content and UI.

These docs describe the 4.0.0-pre.1 API.

⚠️

Preview release. 4.0.0-pre.1 runs end to end in the Unity Editor, but it has not yet been qualified on physical iOS and Android devices. Test localization and navigation on your target devices before you ship. Version 4 replaces the 3.x ARCloudSession API. See Migrating from 3.x.

Requirements

  • An ARCloud project and SDK access token from Graffity Console
  • Unity Editor 6000.6.6f1 with the Android and/or iOS modules
  • AR Foundation, Apple ARKit XR Plugin and Google ARCore XR Plugin 6.6.2 (installed automatically as package dependencies)
  • Universal Render Pipeline (URP)
  • An ARKit or ARCore capable iOS or Android device. Localization needs the real camera, so test on a device.
  • Xcode for iOS builds
  • Network access for SDK settings, localization and navigation data

Installing Graffity’s ARCloud Package

Step 1 - Add the HTTP/2 transport

Localization uses gRPC, which needs HTTP/2. Unity’s built-in HttpClient only supports HTTP/1.1, so add YetAnotherHttpHandler and its NuGet dependencies to your project’s Packages/manifest.json:

Packages/manifest.json
{ "scopedRegistries": [ { "name": "Unity NuGet", "url": "https://unitynuget-registry.openupm.com", "scopes": ["org.nuget"] } ], "dependencies": { "com.cysharp.yetanotherhttphandler.dependencies": "https://github.com/Cysharp/YetAnotherHttpHandler.git?path=src/YetAnotherHttpHandler.Dependencies#1.11.6", "com.cysharp.yetanotherhttphandler": "https://github.com/Cysharp/YetAnotherHttpHandler.git?path=src/YetAnotherHttpHandler#1.11.6" } }

Merge these entries into your existing file and keep your other dependencies. The SDK detects the package automatically. If it is missing, the build prints a warning and start() fails with an error that names the missing package.

Step 2 - Add the Graffity package

Install the package from the Git URL below with the Package Manager (Window > Package Manager > + > Install package from git URL...). See Unity’s official documentation, Installing from a Git URL.

https://github.com/Graffity-Technologies/graffity-arcloud-unity.git#4.0.0-pre.1

The text after # pins a package version tag. Always pin a version so that every machine on your team resolves the same SDK.

All public types are in the Graffity.ARCloud namespace:

using Graffity.ARCloud;

Step 3 - Enable the AR providers

In Project Settings > XR Plug-in Management, enable ARKit on the iOS tab and/or ARCore on the Android tab. Make sure your URP renderer has the AR Background Renderer Feature so the camera feed is visible.

Step 4 - Add permissions

The SDK uses the camera for localization and the device location (GPS) to find candidate maps.

In Project Settings > Player > iOS > Other Settings, set both:

  • Camera Usage Description, for example “Use the camera to locate you and display AR content.”
  • Location Usage Description, for example “Use your location to find nearby AR maps.”

Without a location usage description, iOS never shows the location prompt. The build prints a warning if it is empty.

Scene Setup

You can see the steps below

Step 1 - AR scene setup

  • Add an AR Session and an XR Origin (Mobile AR) from GameObject > XR. The XR Origin’s camera must have an ARCameraManager (the menu adds one).
  • These objects stay yours. The SDK never moves, resets or destroys the AR Session or XR Origin.

Step 2 - Add the ARCloud session

  • Create an empty GameObject, for example Graffity, and add the GraffityARCloudSession component. Keep it outside any map content.
  • Assign the AR Session and XR Origin fields.
  • Paste the SDK Access Token generated in your Graffity Console project. To keep the token out of source control, leave the field empty and set it from code instead.
  • Optional: assign a Navigation Renderer to draw route arrows. See Navigation.

The Inspector reports missing references and other setup problems.

Step 3 - Author content against a map section

  • Open Graffity > AR Cloud > Point clouds, select your session, load your places, then pick a place and a section.
  • Download the section’s point cloud. The SDK creates a GraffityARMapRoot bound to that section, with an Authored content child, and registers it on your session.
  • Place your prefabs and scripts under Authored content, using the point cloud as a guide.

The point cloud is an Editor-only preview and is never included in your build. The SDK keeps Authored content hidden until the device localizes in that section. It then moves the map root so your content lines up with the real world. See Scene Authoring for details.

Step 4 - Start the session

  • Tick Start On Enable on the session to start localizing when the scene loads, or call start() from your own script, for example after your app’s onboarding:
StartGraffity.cs
using System; using Graffity.ARCloud; using UnityEngine; public sealed class StartGraffity : MonoBehaviour, IObserver<GraffityARState> { [SerializeField] private GraffityARCloudSession session; private IDisposable subscription; private void Start() { session.start(); subscription = session.sdk.statePublisher.Subscribe(this); } public void OnNext(GraffityARState state) { if (state.vpsState.kind == GraffityARVPSState.Kind.localized) Debug.Log("Localized in section " + state.vpsState.sectionId); if (state.lastError != null) Debug.LogWarning("Graffity error: " + state.lastError.code); } public void OnError(Exception error) { } public void OnCompleted() { } private void OnDestroy() => subscription?.Dispose(); }

After start():

  1. The SDK loads its settings.
  2. Active localization begins. sdk.localizationGuidance asks the player to hold the phone level, then to aim the camera at suggested targets. Camera frames stream to VPS until it returns a fix. Show your own prompts, or import the Host integration sample for ready-made ones.
  3. The matching GraffityARMapRoot is aligned and its Authored content appears.
  4. Continuous re-localization then corrects drift as the player walks. Small differences are ignored, so content doesn’t jump.
  5. While Auto Retry Localization is on (the default), a failed attempt retries automatically with backoff. You can also call reset() yourself.

Call SDK APIs on the Unity main thread. The session pauses and resumes with the app.

Pre-build Configs

Step 1 - Project Settings > XR Plug-in Management

Make sure ARKit (iOS) and/or ARCore (Android) is enabled for your target platform.

Step 2 - Check permissions and transport

Make sure the iOS camera and location usage descriptions are set and YetAnotherHttpHandler is installed. The build prints a warning if either is missing.

Step 3 - Build Settings

Build the scene to your device. You don’t need to hide or delete point clouds: previews are Editor-only, and the build fails if point-cloud files end up in player assets.

Migrating from 3.x

Version 4 is a new API. There is no automatic migration of 3.x scenes or components. Migrate in a branch and don’t load both versions on the same AR Session.

3.x4.x
Namespace UnityEngine.Graffity.ARCloudNamespace Graffity.ARCloud
ARCloudSession.instance singleton on the AR Session OriginA GraffityARCloudSession component that you reference explicitly
API Credential Config assetAccess Token field in the session Inspector, or setAccessToken()
Init(PositionGps) with the point cloud’s coordinatesNot needed. The SDK uses the device GPS to find candidate maps.
StartLocalize(LocalizeStrategy) and localizeState/localizeProgressstart(), then observe sdk.state and sdk.localizationGuidance
CheckIsAreaAvailableNot available. Localization reports vpsUnavailable or vpsAllAttemptsFailed when it can’t localize.
Manually imported .ply with scale (-1, 1, 1) and Ref Point Cloud TfOne GraffityARMapRoot per section, created by the point-cloud browser, with content under its Authored content child
The SDK moves the AR Session OriginThe SDK moves only your map roots and never moves the XR Origin

Re-author content against each section’s map root, keeping each object in the same place relative to the point cloud.

Report Issues

If you’re facing any issues related to this package, please find out here.