- Home /
Question by
ilievskiplays · Sep 02, 2020 at 03:12 PM ·
playerprefsdata
How to save Coins,PlayerLevel,Player Exp and load it automaticly
i made a script to save and load but it doesnt work when i pickup coins the script doesnt read them so i thought if you can give me example for this script so when i get ingame and i pickup a coin and it autmoaticly saves it and when i play the scene it automaticly loads im noob in this stuff so pls if you can help me i would be so thankfull
here is my Coins pickup script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro;
public class coinspicker : MonoBehaviour { public static float floatvalue;
public float coin = 0;
public TextMeshProUGUI textCoins;
private void OnTriggerEnter2D(Collider2D other)
{
if (other.transform.tag == "Coin") {
coin ++;
textCoins.text = coin.ToString();
Destroy(other.gameObject);
}
}
}
Comment