Question by
Plepin · May 30, 2018 at 10:29 AM ·
serializationdeserialization
How Can I deserialize List type data from a Binary file?
Hi. I create a class(Player_Data) which has a List - public List Gadjets= new List(); below is the actual code
[Serializable] public class Player_Data {
//Data Set from Level_Properties->SetPlayerControlSettings() function
public List<System.Object> Gadjets= new List<System.Object>();------------------------#Object List
public int Id;
public bool Available;
public bool IsMain;
public int Mov_Ctrl;
public int Sub_MCtrl;
public int Pre_Mov_Ctrl;
public int Pre_Sub_MCtrl;
public bool IsAiInput;
public bool IsAiSettings;
//Data set indivisual or from other place
public int AiType;
public int ViewdByTotalEnemy;
public int EnemyAgainstIt;
public float Health;
public int ReachPointSerial;
public int Target;
public bool IsSubPosition;
public int SubPosition;
//public Cover Cover_;
public bool IsInsideCover;
public bool IsTakingCover;
public int BeforeCovMovCtrl;
public int BeforeCovSubMovCtrl;
public int CoverControlType;
public int CoverPos; // 0=mid,-1=left,1=right
public int AnimState; //0=Stand, 1=crouch,2=prone
public List<int> Gadjet_list;
public List<Weapon_Data> Weapon_data;
Gadjets contains multiple types of class object. Now I create an object from this class and save(serialize) it in a binary file. Now how can I Deserialize this class object form file , specially- List Gadjets
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612163708im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
SerializationException Field not found 1 Answer
My singleton is getting reinitialized when I change scene 1 Answer
How to serialize objects of type dictionary and dictionary using MessagePack with il2cpp 0 Answers
How can I separate serializable class into its own file? 1 Answer
"SerializationException: Unexpected binary element: 0" on Deserialization of struct 0 Answers