지속성은 월드 앵커 상태를 동일한 애플리케이션의 여러 실행에 걸쳐 저장하는 시스템으로, 실제 월드의 물리적 위치에 해당하는 “게임 저장” 기능이라고 생각할 수 있습니다. 지속성은 애플리케이션을 다시 실행할 때 월드에서 게임 보드가 어디에 있었는지를 기억하는 것을 예로 들 수 있습니다.
WorldAnchorStore
는 월드 앵커를 저장하고 로드하는 기본 기능을 제공합니다. WorldAnchorStore
를 검색해서 찾아오려면 WorldAnchorStore.GetAsync
를 호출하고 콜백을 제공하십시오. 콜백은 반환된 WorldAnchorStore
를 이후 작업에 사용할 수 있도록 저장합니다.
기존 월드 앵커를 저장하려면 이름을 지정하고 Save
함수를 WorldAnchorStore
에서 호출합니다. 아래 예제를 참조하십시오.
private void SaveAnchor()
{
if (!this.savedAnchor) // only save this once
{
this.savedAnchor = this.MyWorldAnchorStore.Save("MyAnchor", MyWorldAnchor);
if (!this.savedAnchor)
{
// Anchor failed to save to the store.
// Handle errors here.
}
}
}
로딩은 근본적으로 위의 항목과 비슷합니다.
private void LoadAnchor()
{
this.savedAnchor = this.Load("MyAnchor", MyWorldAnchor);
if (!this.savedAnchor)
{
// An anchor with that name wasn't saved to the store.
// Handle errors here.
}
}
앵커를 스토어에서 제거하려면 Delete 메서드를 WorldAnchorStore 에서 호출합니다. 모든 앵커를 스토어에서 제거하려면 Clear 메서드를 호출합니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.