Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Can anyone help with this serialization script (missing the class attribute 'ExtensionOfNativeClass'!)

$
0
0
I was creating big game but I can't solve this problem: I don't whats wrong with this script, name is "SaveLoadManager", can anyone help? public static class SaveLoadManager { public static string SaveName; public static void SavePlayer (Player player) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + SaveName + ".fun", FileMode.Create); PlayerData data = new PlayerData(player); bf.Serialize(stream, data); stream.Close(); } public static PlayerData LoadPlayer() { if (File.Exists(Application.persistentDataPath + SaveName + ".fun")); { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + SaveName + ".fun", FileMode.Open); PlayerData data = bf.Deserialize(stream) as PlayerData; stream.Close(); return data; } } } [Serializable] public class PlayerData { public int health; public float hunger; public float thirst; public float[] position; public GameObject PlayerGameObject; public PlayerData(Player player) { health = player.health; thirst = player.thirst; hunger = player.hunger; position = new float[3]; position[0] = PlayerGameObject.transform.position.x; position[1] = PlayerGameObject.transform.position.y; position[2] = PlayerGameObject.transform.position.z; } } My only problem is this error: ![alt text][1] [1]: /storage/temp/164835-error.png Please help me!

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>