Hello! I need a little bit of help with my sidescroller, essentially, it spawns in Objects when I don't want it too. E.G: http://prntscr.com/5ymlwa Other than there is way too much light... How can I prevent this? Code: Code (CSharp): using UnityEngine; using System.Collections; public class GroundManager : MonoBehaviour { public GameObject[] objects; public float spawnMin = 1f; public float spawnMax = 2f; // Use this for initialization void Start () { Begin (); } void Begin () { Instantiate (objects [Random.Range (0, objects.Length)], transform.position, Quaternion.identity); Invoke ("Begin", Random.Range (spawnMin, spawnMax)); } } Thank you!
I do not understand what you are saying. I am new to Unity ;p. Anyway, essentially I want too make sure that the different stages of the side scroller don't go inside of each other. Instead, only create a new stage when the path is clear and it can spawn with no trouble.
You are invoking "Begin" in Begin ; so Begin is run every frame andyou instantiate a new random object every frame.