public override void SendTangoMesh(int id)
 {
     if (TangoDatabase.GetMeshAsBytes() != null)
     {
         photonView.RPC("ReceiveTangoMesh", PhotonPlayer.Find(id), GetLocalIpAddress() + ":" + Port);
     }
 }
        /// <summary>
        /// Called once per frame
        /// When a new mesh is recieved, display it
        /// When L is pressed, load and send a saved Room Mesh file (used for testing without HoloLens)
        /// </summary>
        public override void Update()
        {
            // ERROR TESTING - REMOVE THIS METHOD - NOTHING SPECIAL HAPPENS IN IT ANYMORE
            base.Update();


            //    //AssetBundle object instantiation for testing purposes
            //    if (Input.GetKeyDown("i"))
            //    {
            //        int id1 = PhotonNetwork.AllocateViewID();

            //        photonView.RPC("SpawnNetworkObject", PhotonTargets.AllBuffered, transform.position, transform.rotation, id1, "Cube");
            //    }
            //}

            if (TangoDatabase.LastUpdate != DateTime.MinValue && DateTime.Compare(_lastUpdate, TangoDatabase.LastUpdate) < 0)
            {
                if (TangoDatabase.GetMeshAsBytes() != null)
                {
                    //    Create a material to apply to the mesh
                    Material meshMaterial = new Material(Shader.Find("Diffuse"));

                    //    grab the meshes in the database
                    IEnumerable <Mesh> temp = new List <Mesh>(TangoDatabase.GetMeshAsList());

                    foreach (var mesh in temp)
                    {
                        //        for each mesh in the database, create a game object to represent
                        //        and display the mesh in the scene
                        GameObject obj1 = new GameObject("tangomesh");

                        //        add a mesh filter to the object and assign it the mesh
                        MeshFilter filter = obj1.AddComponent <MeshFilter>();
                        filter.mesh = mesh;

                        //        add a mesh rendererer and add a material to it
                        MeshRenderer rend1 = obj1.AddComponent <MeshRenderer>();
                        rend1.material = meshMaterial;

                        rend1.material.shader = Shader.Find("Custom/UnlitVertexColor");
                    }
                }
                _lastUpdate = TangoDatabase.LastUpdate;
            }
        }
        public override void SendTangoMesh(string networkConfig)
        {
            var networkConfigArray = networkConfig.Split(':');

            TcpClient client = new TcpClient();

            client.Connect(IPAddress.Parse(networkConfigArray[0]), Int32.Parse(networkConfigArray[1]));
            new Thread(() =>
            {
                using (NetworkStream stream = client.GetStream())
                {
                    var data = TangoDatabase.GetMeshAsBytes();
                    stream.Write(data, 0, data.Length);
                    Debug.Log("Mesh sent: mesh size = " + data.Length);
                }
                client.Close();
            }).Start();
        }
        public override void SendTangoMesh()
        {
            UpdateMesh();

            photonView.RPC("ReceiveTangoMesh", PhotonTargets.MasterClient, PhotonNetwork.player.ID, TangoDatabase.GetMeshAsBytes().Length);
        }