I'm developing an android game but I'm having a hard time saving the input type. For example in this game the user can choose whether to play on the touch or accelerometer, in unity + remote this exchange works well but when I compile and install the apk in the cell phone does not work. Can anyone help me?
void Start()
{
if (PlayerPrefs.HasKey("playerChoice"))
{
if (value == 1)
{
inputAC.SetActive(true);
inputTC.SetActive(false);
}
if (value == 0)
{
inputAC.SetActive(false);
inputTC.SetActive(true);
}
}
}
void Update()
{
if (gameRunning)
uiManagerScript.ShowScoreText(playerScript.score);
}
public void GameOver(int score)
{
scoreManger.AddScore(score);
gameRunning = false;
playerScript.gameObject.SetActive(false);
uiManagerScript.GameEnd();
plataformSpawnerScript.enabled = false;
playerScript.isDead = true;
plataform.gameObject.SetActive(false);
}
public void StartGame()
{
plataformSpawnerScript.enabled = true;
cameraScript.ResetCam();
uiManagerScript.GameStart();
playerScript.score = 0;
playerScript.isDead = false;
gameRunning = true;
plataform.gameObject.SetActive(true);
}
public void InputChoiceFalse()
{
if (PlayerPrefs.HasKey("playerChoice"))
{
PlayerPrefs.SetInt("playerChoice", playerChoice ? 0:1);
value = 1;
PlayerPrefs.Save();
}
}
public void InputChoiceTrue()
{
if (PlayerPrefs.HasKey("playerChoice"))
{
PlayerPrefs.SetInt("playerChoice", playerChoice ? 0 : 1);
value = 0;
PlayerPrefs.Save();
}
}
public void QuitGame()
{
Application.Quit();
}
}