- Home /
Unity Freezing On for-loop,Unity freezing on For loop
// unity freezes whe i run this. Pls help.
// Start is called before the first frame update
void Start()
{
for(int i = 0; i < 5; i++)
{
Debug.Log(i);
}
chosenWord = wordsLocal[Random.Range(0, wordsLocal.Length)];
WordToFindField.text = chosenWord;
}
// Update is called once per frame
void Update()
{
time += Time.deltaTime;
timeField.text = Mathf.Round(time).ToString();
}
} ,// unity keeps freezing every time i run this using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class GameController : MonoBehaviour { public Text timeField; private float time; private string[] wordsLocal = {"MATT", "JOAN", "ROBERT", "MARY JANE", "DENIS"}; public Text WordToFindField; private string chosenWord; private string hiddenWord;
// Start is called before the first frame update
void Start()
{
for(int i = 0; i < 5; i++)
{
Debug.Log(i);
}
chosenWord = wordsLocal[Random.Range(0, wordsLocal.Length)];
WordToFindField.text = chosenWord;
}
// Update is called once per frame
void Update()
{
time += Time.deltaTime;
timeField.text = Mathf.Round(time).ToString();
}
}
Comment