public static void Deserialize(byte[] serialized, out Account account) { account = ObjectPool.Instance.New<Account>(); using (MemoryStream stream = new MemoryStream(serialized)) using (BinaryReader reader = new BinaryReader(stream)) { try { string email = reader.ReadString(); string username = reader.ReadString(); Character[] characters = new Character[reader.ReadByte()]; for (int i = 0; i < characters.Length; i++) { Deserialize(reader.ReadBytes(reader.ReadInt32()), out characters[i]); } account = account.Recreate(username, email, characters); } catch (Exception e) { Debug.Log("Exception at Serialization.Deserialize: " + e.Message); } } }