ARFoundation series of explanations-15ARWorldMap two

5. Save and load plane data and anchor point data

1. Create a new script named ARWorldMapController and the code is as follows:

using System.Collections;
using System.Collections.Generic;
using System.IO;
using Unity.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
#if UNITY_IOS
using UnityEngine.XR.ARKit;
#endif

public class ARWorldMapController : MonoBehaviour
{
    private ARSession m_ARSession;
    private List<string> m_LogMessages = new List<string>();

    [SerializeField]
    private Text m_LogText;
    [SerializeField]
    private Text m_ErrorText;
    [SerializeField]
    private Text m_MappingStatusText;
    [SerializeField]
    private Button m_SaveButton;
    [SerializeField]
    private Button m_LoadButton;
    [SerializeField]
    private Button m_ResetButton;

    private void Awake()
    {
        m_ARSession = FindObjectOfType<ARSession>();
        if (m_ARSession == null)
  

Guess you like

Origin blog.csdn.net/a451319296/article/details/111569699