- Home /
Question by
epic1legend · Jul 06, 2014 at 06:13 AM ·
androidbuildnot working
Unity android game not working in build.
I have a simple android game with spinning rings and a ball that must go through holes in the rings. The rings grow after spinning for so long. It work perfect in the editor, but in the build the rings sometimes grow different amounts. why? please help, i'm flustered by this.
javascript for the circles:
#pragma strict
var T : float = 1;
var collideColor : Color;
var normalColor : Color;
var added : boolean;
var kill : boolean;
var closed : boolean;
var rotSpeed : float;
var totT : float;
var flashing : boolean;
var R : float;
var growing : boolean;
function Start(){
transform.localEulerAngles = new Vector3(0,0,180);
}
function Update () {
totT = GameObject.Find("Player").GetComponent(Timer).totalT;
if(GameObject.Find("Player").GetComponent(Timer).stage == 3){
Scale();
}
if(GameObject.Find("Player").GetComponent(Timer).stage == 1){
Go();
addRound();
}
if(GameObject.Find("Player").GetComponent(Timer).stage == 2){
Flash();
}
if(T == 5){
renderer.material.color -= new Color(0,0,0,.10f);
}
if(T == 6){
Destroy(this.gameObject);
}
}
function Go(){
R = T;
rotSpeed = Mathf.Log(totT, 1.3) * 30;
if(T == 4 && closed == false){
gameObject.GetComponent(Animator).Play("close");
closed = true;
}else{
if(GameObject.Find("Player").GetComponent(Timer).totalT == 1 || GameObject.Find("Player").GetComponent(Timer).totalT == 2){
transform.Rotate(Vector3.forward * Time.deltaTime * 200);
}
if(T == 1 || T == 2){
transform.Rotate(Vector3.forward * Time.deltaTime * 50);
}
if(T == 3){
transform.Rotate(Vector3.back * Time.deltaTime * rotSpeed);
}
}
}
function Scale(){
if(growing == false){
growing = true;
added = true;
transform.localScale += Vector3(0.02 * (R / 1.7),0.02 * (R / 1.7),0);
yield WaitForSeconds(.01);
growing = false;
}else{
return;
}
}
function Flash(){
if(T == 3){
if(GameObject.Find("Player").GetComponent(Timer).stage == 2 && flashing == false){
flashing = true;
renderer.material.color = collideColor;
yield WaitForSeconds(.2);
renderer.material.color = normalColor;
yield WaitForSeconds(.2);
flashing = false;
}
}else{
return;
}
}
function addRound(){
if(added == true){
T += 1;
added = false;
}else{
return;
}
}
javascript for the timer:
#pragma strict
var totalT : float = 1;
var stage : float;
var circle : GameObject;
var spawn : boolean = true;
var rotTime : float = 2;
var end : boolean;
var flashTime : float;
var ranRotTime : float;
var ranRotDir : int;
var waitTime : float;
function Startpress(){
timerTwo();
}
function Randoms(){
ranRotTime = Random.Range(Mathf.Log(4.5, (totalT + 5)) * 8, Mathf.Log(4.5, (totalT + 5)) * 8 - 2);
waitTime = Mathf.Log(1.4, (totalT + 1)) * 13;
}
function timerTwo(){
Randoms();
end = false;
Instantiate (circle, Vector3(0,0,-2), Quaternion.identity);
stage = 1;
if(totalT == 1 || totalT == 2){
yield WaitForSeconds(rotTime);
}else{
yield WaitForSeconds(ranRotTime);
}
timerOne();
}
function timerOne(){
stage = 2;
if(totalT == 1 || totalT == 2){
yield WaitForSeconds(0);
}else{
if(totalT >= 3){
audio.Play();
audio.loop = true;
yield WaitForSeconds(waitTime);
}
}
audio.loop = false;
timerThree();
}
function timerThree(){
stage = 3;
yield WaitForSeconds(.51);
endTimer();
}
function endTimer(){
end = true;
totalT += 1;
timerTwo();
}
function OnTriggerEnter2D(other: Collider2D) {
GameObject.Find("Restart").GetComponent(restart).dead = true;
Destroy(this.gameObject);
}
SORRY I DON'T TYPE WELL WHEN I'M FLUSTERED.
Comment
Your answer
Follow this Question
Related Questions
Multiple EasyAR ImageTracker in different Unity scenes 0 Answers
Can you Build Unity3d Scenes using "-nographics" command line argument 0 Answers
Distribute terrain in zones 3 Answers
Transform.position not working properly? 2 Answers
Game works great, then i build and run, it no longer works. 1 Answer