Question by
Danielman2 · Jan 14, 2016 at 10:40 PM ·
crashcrashing
Unity Script causes Infinite Loop??
I have these two codes who work the same way. But when i build the game, the game crashes and says Oops. and exports a output_log.txt
Here is the code;
#pragma strict
var paPa : GameObject;
var audio1 : AudioSource = GetComponent.<AudioSource>();
var audio2 : AudioSource = GetComponent.<AudioSource>();
var isWinding = false;
var isItCharged = false;
var canWind : boolean = false;
var warningSign1 : GameObject;
var kill : GameObject;
var inTrigg : boolean = false;
var runner : GameObject;
var randomTime : int = Random.Range (20,45);
function Start () {
canWind = true;
warningSign1.active = false;
yield WaitForSeconds(15);
StartCountDown();
}
function StartCountDown () {
isItCharged = false;
Debug.Log("START COUNTDOWN");
yield WaitForSeconds(randomTime);
if( isWinding == false && isItCharged == false ) {
warningSign1.active = true;
}
yield WaitForSeconds(5);
runner.active = true;
yield WaitForSeconds(10);
if( isWinding == false && isItCharged == false ) {
kill.active = true;
}
else if ( isItCharged == true ) {
runner.active = false;
warningSign1.active = false;
}
}
function StartWinding () {
if ( isWinding == true && canWind == true ) {
GameObject.Find("PaPa").GetComponent.<AudioSource>().mute = false;
yield WaitForSeconds(3);
if ( isWinding == true ) {
isItCharged = true;
}
}
}
function OnTriggerExit () {
isWinding = false;
StopWinding();
}
function StopWinding () {
if ( isWinding == false ) {
GameObject.Find("PaPa").GetComponent.<AudioSource>().mute = true;
}
}
function OnTriggerEnter () {
inTrigg = true;
isWinding = true;
StartWinding();
if ( isItCharged == true ) {
audio2.mute = false;
StopWinding();
}
else {
audio2.mute = true;
}
}
][1]
[1]: /storage/temp/61979-output-log.txt
output-log.txt
(24.2 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612060241im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity Crashing for no reason 0 Answers
Unity crashes right after i open a project. 0 Answers
Build crashes on load 0 Answers
android app crashes for no logical reason 0 Answers
AnimatorControllerPlayable.cpp crashes at certain android devices(not all) 0 Answers