public void Start()
    {
        this.CloudManager = AzureSpatialAnchorsDemoWrapper.Instance;

        if (this.CloudManager == null)
        {
            Debug.Log("AzureSpatialAnchorsDemoWrapper doesn't exist in the scene. Make sure it has been added.");
            return;
        }

        Uri result;

        if (!Uri.TryCreate(this.BaseSharingUrl, UriKind.Absolute, out result))
        {
            Debug.Log("BaseSharingUrl, on the AzureSpatialAnchors object in your scene, is not a valid url");
            return;
        }
        else
        {
            this.BaseSharingUrl = $"{result.Scheme}://{result.Host}/api/anchors";
        }

        Debug.Log(this.BaseSharingUrl);

#if !UNITY_EDITOR
        anchorExchanger.WatchKeys(this.BaseSharingUrl);
#endif

        this.CloudManager.OnSessionUpdated         += this.CloudManager_SessionUpdated;
        this.CloudManager.OnAnchorLocated          += this.CloudManager_OnAnchorLocated;
        this.CloudManager.OnLocateAnchorsCompleted += this.CloudManager_OnLocateAnchorsCompleted;
        this.CloudManager.OnLogDebug     += CloudManager_OnLogDebug;
        this.CloudManager.OnSessionError += CloudManager_OnSessionError;
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        //This gets the AzureSpatialAnchorsDemoWrapper.cs component in your scene (must be present in scene)
        CloudManager = AzureSpatialAnchorsDemoWrapper.Instance;


        ////The code below registers Azure Spatial Anchor events
        CloudManager.OnAnchorLocated += CloudManager_OnAnchorLocated;
    }
Esempio n. 3
0
    void Awake()
    {
        anchorModuleScript             = GameObject.FindObjectOfType <AnchorModuleScript>();
        azureSpatialAnchorsDemoWrapper = FindObjectOfType <AzureSpatialAnchorsDemoWrapper>();

        anchorModuleScript.OnStartASASession     += AnchorModuleScript_OnStartASASession;
        anchorModuleScript.OnEndASASession       += AnchorModuleScript_OnEndASASession;
        anchorModuleScript.OnCreateAnchorStarted += AnchorModuleScript_OnCreateAnchorStarted;
        azureSpatialAnchorsDemoWrapper.OnAnchorCreatedSuccessfully += AnchorModuleScript_OnAnchorCreatedSuccessfully;
        azureSpatialAnchorsDemoWrapper.OnAnchorCreationfailed      += AnchorModuleScript_OnAnchorCreationfailed;

        anchorModuleScript.OnFindASAAnchor     += AnchorModuleScript_OnFindASAAnchor;
        anchorModuleScript.OnCreateLocalAnchor += AnchorModuleScript_OnCreateLocalAnchor;
        anchorModuleScript.OnRemoveLocalAnchor += AnchorModuleScript_OnRemoveLocalAnchor;
        anchorModuleScript.OnASAAnchorLocated  += AnchorModuleScript_OnASAAnchorLocated;
    }