Comment on page
Using Server Localizer
- Set up AR Camera in the scene and set it’s tag as ”MainCamera”
- Set up Immersal SDK Prefab with your developer token found from your Immersal Developer Portal.
- Set up AR Localizer object and the AR Space object.
- In the AR Localizer, enable “Use Server Localizer” and type in the map IDs
- Set up your map loader. More on this further below

Set up the AR Localizer object

Set up the AR Space object
- Load the maps using the menu Immersal SDK/AR Map Downloader
- Load the alignment data once you’ve previously aligned the maps elsewhere.
- Place your 3D content under the same gameObject that the maps were loadedunder.
- Once happy, you can delete the maps from scene and the Assets/Map Data folder.

Once the maps have been aligned, they can be deleted
- Create a map loader script that loads the maps in Start() as “empty” ARMaps and applies the transforms.
- The Server Localization setup is then done. Your ARSpace object will get transformed along with your 3D objects on successful localization.

Create a map loader script and place it in the scene
- In order to make on server localization work you need to register to an ARSpace the ARMap you want to localize to. Scripts below does it for you on Start()
using System.Threading.Tasks;
using Immersal.AR;
using Immersal.REST;
using UnityEngine;
public class MapLoader : MonoBehaviour
{
[SerializeField] private Transform m_root;
[SerializeField] private bool m_applyAlignment = true;
void Start()
{
LoadMapsAsync();
}
private async void LoadMapsAsync()
{
foreach (var id in ARLocalizer.Instance.mapIds)
{
SDKJob job = new SDKJob();
job.id = id.id;
await LoadWithNoBinary(job);
}
}
private async Task LoadWithNoBinary(SDKJob job)
{
Debug.Log($"Loading map {job.id} with no binary");
await ARSpace.LoadAndInstantiateARMap(m_root, job, null, ARMap.RenderMode.DoNotRender, default, m_applyAlignment);
}
}
Last modified 3mo ago