using UnityEngine; [System.Serializable] public class PlayerData { public int level; public float[] position; // Constructor that takes a Player instance public PlayerData(Player player) { level = player.level; position = new float[3]; // Store 3D position (x, y, z) position[0] = player.transform.position.x; position[1] = player.transform.position.y; position[2] = player.transform.position.z; } }