- Home /
Question by
unity_5945F3743E75524D8DFA · Apr 02 at 06:15 AM ·
endless runnerbrightnessendless loop
Enviroment gets increasingly brighter when running
Hi,
Am a newbie to Unity, was following a Youtube tutorial on creating a endless runner 3D game. was trying to get it to repeat section. But problem is, the enviroment get's brighter and brighter once the game runs. What is wrong with the code below? Thanks! :)`enter code here`
public class GenerateLevel : MonoBehaviour
{
public GameObject[] section;
public int zPos = 39;
public bool creatingSection = false;
public int secNum;
void Update()
{
if (creatingSection == false)
{
creatingSection = true;
StartCoroutine(GenerateSection());
}
}
IEnumerator GenerateSection()
{
secNum = Random.Range(0, 3);
Instantiate(section[secNum], new Vector3(0, 0, zPos), Quaternion.identity);
zPos += 39;
yield return new WaitForSeconds(2);
creatingSection= false;
}
}
Comment
Is it possible that the section GameObject you are spawning contains a directional light component?
Your answer
Follow this Question
Related Questions
Obstacle loop 0 Answers
Question about tree setting Occlusion I think it's called 1 Answer
How do I adjust the brightness, color and contrast using a slider? 0 Answers
Create an unlimited terrain 2 Answers
Endless runner distance 2 Answers