How to initialize a CloudSpatialAnchorSession?

  • Import AzureSpacialAnchors asset into your script.

using Microsoft.Azure.SpatialAnchors;
  • Add the CloudSpatialAnchorSession and CloudSpatialAnchor member variables into your AzureSpatialAnchorsScript class:

/// <summary>
/// Use the recognizer to detect air taps.
/// </summary>
private GestureRecognizer recognizer;

protected CloudSpatialAnchorSession cloudSpatialAnchorSession;

/// <summary>
/// The CloudSpatialAnchor that we either 1) placed and are saving or 2) just located.
/// </summary>
protected CloudSpatialAnchor currentCloudAnchor;

/// <summary>
/// True if we are 1) creating + saving an anchor or 2) looking for an anchor.
/// </summary>
protected bool tapExecuted = false;
  • Initialize Session:

  • Add methods to handle delegate calls.

  • Call the InitializeSession() method inside the Start() function:

Last updated

Was this helpful?