public void LoadPlaneList(JToken mapMetadata) { if (loadedPlaneList.Count > 0) { foreach (var planeGo in loadedPlaneList) { Destroy(planeGo); } loadedPlaneList.Clear(); } if (mapMetadata is JObject && mapMetadata["planes"] is JObject) { PlaneMeshList planeList = mapMetadata["planes"].ToObject <PlaneMeshList>(); if (planeList == null) { Debug.Log("Empty list of planes in metadata"); return; } Debug.Log("Loading + " + planeList.meshList.Length.ToString() + " planes"); foreach (var plane in planeList.meshList) { GameObject go = CapturedPlaneUtility.CreatePlaneInScene(plane); go.AddComponent <DontDestroyOnLoad>(); //this is so these GOs persist across scene loads loadedPlaneList.AddLast(go); } } else { Debug.Log("No plane metadata available"); return; } }
// Use this for initialization void Start() { loadedPlaneList = new LinkedList <GameObject>(); if (UnityARSessionNativeInterface.IsARKit_1_5_Supported()) { CapturedPlaneUtility.InitializePlanePrefab(meshPrefab); } else { CapturedPlaneUtility.InitializePlanePrefab(planePrefab); } }