using UnityEngine; public class Player : MonoBehaviour { public int level = 1; // Example player level // Example method to update player stats public void LevelUp() { level++; Debug.Log("Player leveled up! Current level: " + level); } // Save the player state public void SavePlayer() { SaveSystem.SavePlayer(this); } // Load the player state public void LoadPlayer() { PlayerData data = SaveSystem.LoadPlayer(); // Corrected call to SaveSystem if (data != null) // Check if data was successfully loaded { level = data.level; // Initialize position and assign values Vector3 position = new Vector3(); position.x = data.position[0]; position.y = data.position[1]; position.z = data.position[2]; // Update the player's position transform.position = position; } else { Debug.LogError("No save data found!"); } } }