public void ResolveNewObject(NewObjectPacket packet) { if (!objectDict.ContainsKey(packet.movableId)) { GameObject gameObject = null; switch (packet.category) { case Category.Player: gameObject = Instantiate(player); gameObject.transform.SetParent(map.transform); break; case Category.Enemy: gameObject = Instantiate(enemy); gameObject.transform.SetParent(map.transform); break; } if (gameObject != null) { MObject mObject = gameObject.GetComponent <MObject> (); mObject.name = "object_" + packet.movableId; mObject.SetUp(packet); objectDict.Add(packet.movableId, mObject); } } }