public void GetData() { Debug.Log("Saving player data"); levelCounter++; //Save player health BarController player = GameObject.Find("Captain").GetComponent <BarController>(); playerHealth = player.GetHealth(); //Get Coins playerCoins = player.GetCoins(); //Get Resources playerResources = player.GetResources(); //Get Score playerScore = player.GetScore(); //Get Crafting Cost playerCraftingCost = player.craftingCost; //Gey Key playerKey = player.foundKey; //Get Player Revived State playerRevived = player.GetPlayerRevived(); //Get Extra Stats playerUpgradedAttack = player.upgradedDamage; playerUpgradedDefence = player.upgradedDefence; playerUpgradedHealth = player.upgradedHealth; playerUpgradedSpeed = player.upgradedSpeed; //Get Challenge counter playerChallengeCounter = player.challengeCounters; //Get Inventory PlayerInventory inventoryScript = GameObject.Find("Captain").GetComponent <PlayerInventory>(); playerInventory = inventoryScript.slotID; this.slotID = inventoryScript.slotID; this.slotValue = inventoryScript.slotValue; this.slotName = inventoryScript.slotName; this.slotDesc = inventoryScript.slotDesc; this.slotSprite = inventoryScript.slotSprite; this.slotType = inventoryScript.slotType; this.slotStack = inventoryScript.slotStack; this.slotIcon = inventoryScript.slotIcon; //Get Villager villageState = GameObject.Find("PickUpRange").GetComponent <PlayerInteract>().UnlockedVillagers; }