/// <summary>
        /// Updates an existing surface object.
        /// </summary>
        /// <param name="gameObject">Game object reference to the surfaceObject.</param>
        /// <param name="meshID">User specified ID for the mesh.</param>
        /// <returns>True if successful</returns>
        protected void UpdateSurfaceObject(GameObject gameObject, int meshID)
        {
            // If it's in the list, update it
            for (int i = 0; i < SurfaceObjects.Count; ++i)
            {
                if (SurfaceObjects[i].Object == gameObject)
                {
                    SurfaceObject thisSurfaceObject = SurfaceObjects[i];
                    thisSurfaceObject.ID = meshID;
                    thisSurfaceObject.UpdateID++;
                    SurfaceObjects[i] = thisSurfaceObject;
                    return;
                }
            }

            // Not in the list, add it
            SurfaceObject surfaceObject = new SurfaceObject();

            surfaceObject.ID       = meshID;
            surfaceObject.UpdateID = 0;

            surfaceObject.Object   = gameObject;
            surfaceObject.Filter   = surfaceObject.Object.GetComponent <MeshFilter>();
            surfaceObject.Renderer = surfaceObject.Object.GetComponent <MeshRenderer>();

            SurfaceObjects.Add(surfaceObject);
        }
        /// <summary>
        /// Creates a new surface game object.
        /// </summary>
        /// <param name="mesh">The mesh to attach. Can be null.</param>
        /// <param name="objectName">What to name this object.</param>
        /// <param name="parentObject">What to parent this object to.</param>
        /// <param name="meshID">Optional user specified ID for the mesh.</param>
        /// <returns>The newly created game object.</returns>
        protected GameObject AddSurfaceObject(Mesh mesh, string objectName, Transform parentObject, int meshID = 0)
        {
            SurfaceObject surfaceObject = new SurfaceObject();

            surfaceObject.ID       = meshID;
            surfaceObject.UpdateID = 0;

            surfaceObject.Object = new GameObject(objectName, componentsRequiredForSurfaceMesh);
            surfaceObject.Object.transform.SetParent(parentObject);
            surfaceObject.Object.layer = SpatialMappingManager.Instance.PhysicsLayer;

            surfaceObject.Filter            = surfaceObject.Object.GetComponent <MeshFilter>();
            surfaceObject.Filter.sharedMesh = mesh;

            surfaceObject.Renderer = surfaceObject.Object.GetComponent <MeshRenderer>();
            surfaceObject.Renderer.sharedMaterial = RenderMaterial;

            SurfaceObjects.Add(surfaceObject);

            return(surfaceObject.Object);
        }