private void onAnchorLoadedFromStore(bool successfull) { if (successfull) { Debug.Log("Device " + gameObject.name + " loaded anchor from store successfully"); anchorOrigin = AnchorOrigin.Local; StartCoroutine(loadAnchorFromServerifNotLocated(20)); } }
private IEnumerator loadAnchorFromServerifNotLocated(int seconds) { yield return(new WaitForSeconds(seconds)); var WA = GetComponent <WorldAnchor>(); //if anchor not located within this time if (anchorOrigin == AnchorOrigin.Local && WA != null && !this.GetComponent <WorldAnchor>().isLocated) { Debug.Log("Device " + gameObject.name + " local anchor could not be located, now trying from server"); anchorOrigin = AnchorOrigin.OverrideAnchorFromServer;//set to override StartCoroutine(startLoadAnchorFromServer(0)); } }
private void onImportCompleteForUnity(object transferBatchObject) { WorldAnchorTransferBatch transferBatch = (WorldAnchorTransferBatch)transferBatchObject; //before we lock this, we remove the world anchor detachWorldAnchor(); //locks it in place WorldAnchor wa = transferBatch.LockObject(gameObject.name, this.gameObject); anchorOrigin = AnchorOrigin.Server; //saves the importet anchor in the store WorldAnchorManager.Instance.SaveAnchor(this.gameObject); //if import complete, we take the time from information as current time latestAnchor = importInformation.anchorTime; //reset importInformation = default(ImportInformation); }