Android apk fail
Hi, i will try to explain the better i can, so, my game is working perfect, is just a simple pong, nothing special, but when i build and make the apk with no errors, i install the game on my phone but the score doesnt work, i alredy tryed all, i dont know what i can do... using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement;
public class Playerpuntuacio:MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D ( Collider2D coll){
if (coll.gameObject.tag == "ball"){
Managerintent.Scoreplayer++;
}
}
}
This is the sript from the " collider " using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement;
public class Managerr : MonoBehaviour { public Text textScoreplayer; public Text textEnemiplayer; public static int Scoreplayer; public static int scoreenemy; // Use this for initialization void Start () {
}
// Update is called once per frame
void Update () {
textEnemiplayer.text = scoreenemy.ToString()+ " ";
textScoreplayer.text = " " + Scoreplayer.ToString() ;
if (scoreenemy == 21) {
Gameover ();
}
if (Scoreplayer == 21) {
Gameover ();
}
}
void Gameover(){
SceneManager.LoadScene (5);
}
} and this is the manager, i repet all is working in unity but not on my phone ...
Answer by Kagedmonkey40 · Mar 25, 2016 at 09:51 PM
Did you ever find solution for this? I'm having the same issue. I've tried using the line: SceneManager.LoadScene("Title");
and also SceneManager.LoadScene(1);
In both cases it works fine in the editor, standalone PC, Mac builds but it will not work at all on any Android device. My case is alot more troubling as mine requires no user input to get to this scene load. Simply put I have the initial scene (logo screen) and it immediately checks screen height/width to determine if it should load the "Title" scene or the "TitleLandscape" scene so the script is literally an if else statement and that is it.