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. It is a low-level SDK: your scenes and scripts own all content and UI, and you decide how to present localization and navigation. For a ready-made experience, see the iOS SDK.

These docs describe the 4.0.0-pre.9 API.

⚠️

Preview release. 4.0.0-pre.9 passes the Unity Editor test suite on Unity 6000.3 and 6000.6 against simulated services. Physical iOS/Android qualification is still open. 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.3.28f1 (the 6000.3 LTS line) up to the 6000.6 line, with the Android and/or iOS modules
  • AR Foundation 6.7.1 or later (installed automatically as a package dependency)
  • Apple ARKit XR Plugin and/or Google ARCore XR Plugin 6.7.1 or later, for each platform you target. The Setup window installs them.
  • Universal Render Pipeline (URP)
  • An ARKit or ARCore capable iOS or Android device to localize for real. In the Editor you can simulate localization.
  • Xcode for iOS builds
  • Network access for SDK settings, localization and navigation data

Installing Graffity’s ARCloud Package

Step 1 - 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.9

For a provided preview .tgz, choose Install package from tarball in Package Manager. The Git URL above requires the corresponding tag to have been published.

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;

If your scripts are in an assembly definition, reference Graffity.ARCloud.Runtime, Graffity.ARCloud.Domain and Graffity.ARCloud.Contracts. Scripts without an assembly definition see them automatically.

Step 2 - Install the HTTP/2 transport and AR providers

Localization uses gRPC, which needs HTTP/2. Unity’s built-in HttpClient only supports HTTP/1.1, so the SDK uses YetAnotherHttpHandler.

The Graffity AR Cloud Setup window opens by itself the first time the package compiles without the transport. You can also open it from Window > Graffity AR Cloud > Setup.

  • Click Install HTTP/2 transport. It adds YetAnotherHttpHandler 1.11.6, its dependencies package and the OpenUPM scoped registry for org.nuget to Packages/manifest.json. It keeps entries you already have.
  • Click Install (or Upgrade) next to ARKit for iOS and/or ARCore for Android. They aren’t package dependencies, so an iOS-only project doesn’t need ARCore.

The session Inspector shows the same install button while the transport is missing.

Step 3 - Enable input and AR providers

In Project Settings > Player > Other Settings, set Active Input Handling to Input System Package (New) or Both and restart Unity. The Mobile AR origin uses an Input System TrackedPoseDriver; the old Input Manager alone can leave camera poses frozen even while camera video works.

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.

Project Settings > XR Plug-in Management > Project Validation lists anything still missing under Graffity AR Cloud (transport, AR provider, ARCore loader, input handling, iOS location usage description), each with a Fix button.

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. Project Validation flags it.

Step 5 - Add your access token

Open Project Settings > Graffity AR Cloud, click Create settings asset and paste the SDK Access token from your Graffity Console project.

  • The page shows the project the token belongs to. Test connection asks the server whether it accepts the token.
  • The token is stored in Assets/Graffity/GraffityARCloudSettings.asset. Every session uses it and every player build includes it. No scene stores the token.
  • To supply the token at runtime instead, for example from your backend, set it from code.
ℹ️

Graffity Console issues permanent and temporary SDK tokens. A temporary token expires one day after it is created, and a build that uses it stops localizing with InvalidAccessToken. Project Settings and the session Inspector warn when your token is temporary; use a permanent token for builds. Creating a new permanent token invalidates the previous one at once, including in apps you have already released.

Scene Setup

You can see the steps below

Step 1 - Add the ARCloud session

Choose GameObject > XR > Graffity AR Cloud Session. It creates a GraffityARCloudSession and assigns the scene’s AR Session and XR Origin. If the scene has neither, it creates them with AR Foundation’s XR Origin (Mobile AR).

Adding the GraffityARCloudSession component to any GameObject does the same assignment when the scene has exactly one AR Session and one XR Origin. Keep the session outside any map content.

  • The AR Session and XR Origin stay yours. The SDK never moves, resets or destroys them.
  • The session Inspector lists any remaining setup problem. A Fix button repairs problems with one correct fix, for example a missing ARCameraManager. A Select button shows the object when the choice is yours.
  • Optional: assign a Navigation Renderer to draw route arrows. See Navigation.

Step 2 - Author content against a map section

  • Open Window > Graffity AR Cloud > Point Cloud Browser, 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 3 - Start the session

Tick Start On Enable on the session to start localizing when the scene loads, or call StartSession() from your own script, for example after your app’s onboarding:

StartGraffity.cs
using Graffity.ARCloud; using UnityEngine; public sealed class StartGraffity : MonoBehaviour { [SerializeField] private GraffityARCloudSession session; private void OnEnable() { // Session events survive ShutdownAsync and re-initialization. session.Localized += OnLocalized; session.Failed += OnFailed; } private void OnDisable() { session.Localized -= OnLocalized; session.Failed -= OnFailed; } private void Start() => session.StartSession(); private void OnLocalized(string sectionId) => Debug.Log("Localized in section " + sectionId); private void OnFailed(GraffityARCloudError error) => Debug.LogWarning(error.Code + ": " + error.RecoverySuggestion); }

The same notifications are available as UnityEvents in the session Inspector’s Events foldout, so simple reactions need no script.

After StartSession():

  1. The SDK loads its settings.
  2. Active localization begins. session.Guidance 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 ResetSession() yourself.

Call SDK APIs on the Unity main thread. The session pauses and resumes with the app. Permission denial, unsupported AR, prolonged tracking loss and repeated frame-processing failures arrive through the Failed event and session.State.LastError.

Step 4 - Test in the Editor

Press Play. In the Editor the session simulates localization: choose a section in the session Inspector and click Localize, then navigate and walk the route. Your event handlers run as they do on a device. See Test in the Editor.

Pre-build Configs

Step 1 - Check Project Validation

Open Project Settings > XR Plug-in Management > Project Validation for your target platform and fix every Graffity AR Cloud entry.

Step 2 - Check your token

Use a permanent token in Project Settings > Graffity AR Cloud. A build that contains a session logs a warning if the token is temporary.

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 never included in a player.

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 in Project Settings > Graffity AR Cloud, or session.AccessToken from code
Init(PositionGps) with the point cloud’s coordinatesNot needed. The SDK uses the device GPS to find candidate maps.
StartLocalize(LocalizeStrategy) and localizeState/localizeProgressStartSession(), then the StateChanged and GuidanceChanged events, or session.State and session.Guidance
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.