using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.WSA;
using UnityEngine.XR.WSA.Persistence;
public class MyCube : MonoBehaviour
{
public string ObjectAnchorStoreName;
WorldAnchorStore anchorStore;
bool placing = false;
public GameObject Text;
void Start()
{
//获取WorldAnchorStore 对象
WorldAnchorStore.GetAsync(AnchorStoreReady);
}
private void AnchorStoreReady(WorldAnchorStore store)
{
anchorStore = store;
string[] ids = anchorStore.GetAllIds();
//遍历之前保存的空间锚,载入指定id场景对象信息
for (int index = 0; index < ids.Length; index++)
{
if (ids[index] == ObjectAnchorStoreName)
{
WorldAnchor wa = anchorStore.Load(ids[index], gameObject);
break;
}
}
}
void OnSelect()
{
if (anchorStore == null)
{
return;
}
if
Hololens空间锚点+场景保持
最新推荐文章于 2024-06-07 11:21:14 发布