예제 #1
0
        void OnRecvDelete(DeleteMessage mes)
        {
            int numEntities = mes.numEntities;

            for (int i = 0; i < numEntities; ++i)
            {
                EraseEntityRecord(mes.GetEntity(i));
            }

            int numMaterials = mes.numMaterials;

            for (int i = 0; i < numMaterials; ++i)
            {
                EraseMaterialRecord(mes.GetMaterial(i).id);
            }
        }
예제 #2
0
        void OnRecvDelete(DeleteMessage mes)
        {
            int numTargets = mes.numTargets;

            for (int i = 0; i < numTargets; ++i)
            {
                var id   = mes.GetID(i);
                var path = mes.GetPath(i);

                if (id != 0 && m_hostMeshes.ContainsKey(id))
                {
                    var rec = m_hostMeshes[id];
                    if (rec.go != null)
                    {
#if UNITY_EDITOR
                        Undo.DestroyObjectImmediate(rec.go);
                        Undo.RecordObject(this, "MeshSyncServer");
#else
                        DestroyImmediate(rec.go);
#endif
                    }
                    m_hostMeshes.Remove(id);
                }
                else if (m_clientMeshes.ContainsKey(path))
                {
                    var rec = m_clientMeshes[path];
                    if (rec.go != null)
                    {
#if UNITY_EDITOR
                        Undo.DestroyObjectImmediate(rec.go);
                        Undo.RecordObject(this, "MeshSyncServer");
#else
                        DestroyImmediate(rec.go);
#endif
                    }
                    m_clientMeshes.Remove(path);
                }
            }

            //Debug.Log("MeshSyncServer: Delete");
        }