Пример #1
0
        public Guid PlaceAnchor(bool saveAchor)
        {
            // create a new anchor id for saving and sharing
            Guid anchorId = Guid.NewGuid();

            TargetGameObject = TargetGameObject == null ? gameObject : TargetGameObject;
#if UNITY_WSA
            ClearAnchor(false);

            var storageIdString = anchorId.ToString();

            // Notify other that an anchor is about to be placed
            RaiseAnchorPersistenceEvent(AnchorPersistenceEventType.Placing, TargetGameObject, storageIdString);

            // Apply anchor
            TargetGameObject.AddComponent <WorldAnchor>();
            _isAnchored = true;

            // Notify others that an anchor was placed
            RaiseAnchorPersistenceEvent(AnchorPersistenceEventType.Placed, TargetGameObject, storageIdString);

            if (saveAchor)
            {
                saveLoad.SaveLocation(anchorId, TargetGameObject, worldAnchorStore);
            }
#endif
            return(anchorId);
        }
        public bool PlaceAnchor(bool saveAchor)
        {
            TargetGameObject = TargetGameObject == null ? gameObject : TargetGameObject;
#if UNITY_WSA
            if (saveAchor)
            {
                _isAnchored = saveLoad.SaveLocation(TargetGameObject, ref worldAnchorStore);
            }
            else
            {
                ClearAnchor(false);
                TargetGameObject.AddComponent <WorldAnchor>();
                _isAnchored = true;
            }
#endif
            return(_isAnchored);
        }