SerializationException:类型UnityEngine.GameObject未标记为Serializable。但它是

时间:2018-04-14 11:40:17

标签: unity3d

我正在尝试使用此

保存内容
{
       if(File.Exists(Application.persistentDataPath + "/player.timeline"))
        {
            BinaryFormatter Bf = new BinaryFormatter();
            FileStream stream = new FileStream(Application.persistentDataPath + "/player.timeline", FileMode.Open);
            PlayerData Data = Bf.Deserialize(stream) as PlayerData;
            stream.Close();
            return Data.Stats;
        }

当我去做这个

for (int E = 0;E<Eqipment.Length; E++)
            {
                Eqipment[E] = "NA";
                if (E <Player.equipment.Count)
                {
                    Eqipment[E] = Player.equipment[E].IteamName;
                }
            }

我得到SerializationException: Type UnityEngine.GameObject is not marked as Serializable。但它是

[System.Serializable]
public class ItemCard
{
    public string IteamName;
    public string Description;
    public int amount;
    public float HPBosst;

}

我真的很困惑。

0 个答案:

没有答案