Help offline progression, works on windows but not on Android.
using UnityEngine;
using System.Collections;
using System;
public class IdleEggs : MonoBehaviour
{
public Clicker click;
public float oE;
void OnApplicationQuit(){
long date = DateTime.UtcNow.Ticks / 10000 / 1000;
PlayerPrefs.SetString("lastDate", Convert.ToString(date));
print ("Date: " + date);
}
void Start(){
long nowDate = DateTime.UtcNow.Ticks / 10000 / 1000;
string lastDateS = PlayerPrefs.GetString ("lastDate");
long lastDate = Convert.ToInt64 (lastDateS);
long secondsSinceLastDateL = nowDate - lastDate;
String secondsSinceLastDateS = Convert.ToString (secondsSinceLastDateL);
float secondsSinceLastDate = float.Parse (secondsSinceLastDateS);
print ("Sec: " + secondsSinceLastDate);
oE = (secondsSinceLastDate * click.eggsPerSecond) * 10.05f;
print ("oE: " + Mathf.Round(oE));
click.eggs += Mathf.Round(oE);
print ("New eggs: " + click.eggs);
}
}
Hey Guys!!
We are trying to make an app for Android, we want to have offline progression based on our eggspersecond. In Unity the functions is working well, but when we open the app on android the oE value is not added to the click.eggs.
Comment
Your answer
Follow this Question
Related Questions
PlayerPrefs saving and Loading 2 Answers
Save Data Android C# 0 Answers
Save game - Tile based game 0 Answers
Loading live data to Unity from Processing 0 Answers
I can't figure out why my score doesn't save/increase 0 Answers