我的团结安卓应用程序出现问题,场景冻结如下: 基本上它是一个场景,玩家选择他想要使用的用户。它向左或向右滚动。我有10个用户空间,可以启用或使用diasbled。
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class active : MonoBehaviour {
public GameObject Player_1;
public GameObject Player_2;
public GameObject Player_3;
public GameObject Player_4;
public GameObject Player_5;
public GameObject Player_6;
public GameObject Player_7;
public GameObject Player_8;
public GameObject Player_9;
public GameObject Player_10;
public GameObject PlusButton;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
int a8;
int a9;
int a10;
int a11;
// Use this for initialization
void Start () {
float y = Player_1.transform.position.y;
float z = Player_1.transform.position.z;
if (PlayerPrefs.GetInt ("active1") == 1) {
Player_1.SetActive (true);
a2 ++;
a3 ++;
a4 ++;
a5 ++;
a6 ++;
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_1.transform.position = new Vector3 (222,y,z);
} else {
Player_1.SetActive (false);
}
if (PlayerPrefs.GetInt ("active2") == 1) {
Player_2.SetActive (true);
a3 ++;
a4 ++;
a5 ++;
a6 ++;
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_2.transform.position = new Vector3 (a2 * 200+222,y,z);
} else {
Player_2.SetActive (false);
}
if (PlayerPrefs.GetInt ("active3") == 1) {
Player_3.SetActive (true);
a4 ++;
a5 ++;
a6 ++;
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_3.transform.position = new Vector3 (a3 * 200+222,y,z);
} else {
Player_3.SetActive (false);
}
if (PlayerPrefs.GetInt ("active4") == 1) {
Player_4.SetActive (true);
a5 ++;
a6 ++;
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_4.transform.position = new Vector3 (a4*200+222,y,z);
} else {
Player_4.SetActive (false);
}
if (PlayerPrefs.GetInt ("active5") == 1) {
Player_5.SetActive (true);
a6 ++;
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_5.transform.position = new Vector3 (a5*200+222,y,z);
} else {
Player_5.SetActive (false);
}
if (PlayerPrefs.GetInt ("active6") == 1) {
Player_6.SetActive (true);
a7 ++;
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_6.transform.position = new Vector3 (a6*200+222,y,z);
} else {
Player_6.SetActive (false);
}
if (PlayerPrefs.GetInt ("active7") == 1) {
Player_7.SetActive (true);
a8 ++;
a9 ++;
a10 ++;
a11 ++;
Player_7.transform.position = new Vector3 (a7*200+222,y,z);
} else {
Player_7.SetActive (false);
}
if (PlayerPrefs.GetInt ("active8") == 1) {
Player_8.SetActive (true);
a9 ++;
a10 ++;
a11 ++;
Player_8.transform.position = new Vector3 (a8*200+222,y,z);
} else {
Player_8.SetActive (false);
}
if (PlayerPrefs.GetInt ("active9") == 1) {
Player_9.SetActive (true);
a10 ++;
a11 ++;
Player_9.transform.position = new Vector3 (a9*200+222,y,z);
} else {
Player_9.SetActive (false);
}
if (PlayerPrefs.GetInt ("active10") == 1) {
Player_10.SetActive (true);
a11 ++;
Player_10.transform.position = new Vector3 (a10*200+222,y,z);
} else {
Player_10.SetActive (false);
}
Vector3 pos = new Vector3 (a11 * 200+222 , y, z);
PlusButton.transform.position = pos;
}
}
是什么导致这种情况?