hi all, sorry if this has been asked already but i’m stuck.
im making a game that will have a lives manager and a double jump manager. i have set playprefs values for each of these and it works fine on game view but once i build an apk file it refuses to allow me to play as the lives value i set in the playerprefs isnt working so its setting lives to 0 meaning no lives to play game. below is my code for the relevant parts.
First the Lives and Double Jump managers
using UnityEngine;
using System.Collections;
public class LivesManagerScript : MonoBehaviour {
public static int lives = 6;
void Awake()
{
DontDestroyOnLoad (gameObject);
}
void Start()
{
PlayerPrefs.SetInt ("Lives", lives);
}
void Update()
{
PlayerPrefs.SetInt ("Lives", CharacterMove.lives);
}
}
using UnityEngine;
using System.Collections;
public class DoubleJumperManagerScript : MonoBehaviour {
public static int dJumpLimit = 30;
void Awake()
{
DontDestroyOnLoad (gameObject);
}
void Start()
{
PlayerPrefs.SetInt ("DoubleJumps", dJumpLimit);
}
void Update()
{
PlayerPrefs.SetInt ("DoubleJumps", CharacterMove.dJumpLimit);
}
}
next is start button
using UnityEngine;
using System.Collections;
public class StartButtonScript : MonoBehaviour {
public int lives = 0;
void Awake()
{
lives = PlayerPrefs.GetInt ("Lives");
}
void Update()
{
if (Input.touches.Length <= 0) {
}
else
{
for(int i = 0; i < Input.touchCount; i++)
{
if(this.guiTexture.HitTest (Input.GetTouch (i).position))
{
if(Input.GetTouch(i).phase == TouchPhase.Ended)
{
if(lives > 0)
{
Application.LoadLevel (1);
}
}
}
}
}
}
}
the managers are on the scene after the start button is pressed. i tried this on the start button scene and that didnt work either. any help will be appreciated