July 2017
Beginner to intermediate
390 pages
10h 53m
English
First, HandleNewOrUpdated():
void HandleNewOrUpdated(SurfaceId surfaceId, Bounds bounds, DateTime lastModification) { if (!_meshList.ContainsKey(surfaceId)) { // It's a new one GameObject newSurfaceObject = new GameObject("hl_sm_" + surfaceId); newSurfaceObject.transform.parent = this.transform; newSurfaceObject.AddComponent<MeshRenderer>(); _meshList[surfaceId] = newSurfaceObject; } // It's an update or a new one, but we can now treat // them the same var surfaceObject = _meshList[surfaceId]; var sd = new SurfaceData( surfaceId, // surfaceId, surfaceObject.GetComponent<MeshFilter>() ?? surfaceObject.AddComponent<MeshFilter>(), // mesh filter surfaceObject.GetComponent<WorldAnchor>() ?? surfaceObject.AddComponent<WorldAnchor>(), ...Read now
Unlock full access