using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EcoNoM : MonoBehaviour
{
// Start is called before the first frame update
public double Balance;
public Text text;
public int GH = 100;
public double UP;
public double ch = 0.000001;
void Start()
{
InvokeRepeating("Hah", 0, 1);
}
public void Hah()
{
UP = (GH * ch);
Balance += UP;
string LoadBalance = PlayerPrefs.GetString("Bal");
text.text = LoadBalance;
string results = LoadBalance.ToString();
PlayerPrefs.SetString("Bal", results);
PlayerPrefs.Save();
}
// Update is called once per frame
void Update()
{
}
}
UP = (GH * ch);
Balance += UP;
string results = LoadBalance.ToString();
PlayerPrefs.SetString("Bal", results);
PlayerPrefs.Save();
string LoadBalance = PlayerPrefs.GetString("Bal");
text.text = LoadBalance;
Balance
, а сохраняешь LoadBalance
. А затем почему-то удивляешься, почему не сохранилось. UP = (GH * ch);
Balance += UP;
PlayerPrefs.SetString("Bal", Balance.ToString());
PlayerPrefs.Save();
text.text = PlayerPrefs.GetString("Bal");
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EcoNoM : MonoBehaviour
{
// Start is called before the first frame update
public double Balance;
public Text text;
public int GH = 100;
public double UP;
public double ch = 0.000001;
void Start()
{
InvokeRepeating("Hah", 0, 1);
}
public void Hah()
{
UP = (GH * ch);
Balance += UP;
PlayerPrefs.SetString("Bal", Balance.ToString());
PlayerPrefs.Save();
text.text = Balance.ToString();
}
// Update is called once per frame
void Update()
{
}
}