// Start is called before the first frame update void Start() { control = gameObject.GetComponent <BGScroll>(); Stars = gameObject.transform.GetChild(0).gameObject; StarControl = Stars.GetComponent <BGScroll>(); textureChoice = (int)UnityEngine.Random.Range(0, SpaceBGs.Length); gameObject.GetComponent <Renderer>().sharedMaterial.mainTexture = SpaceBGs[textureChoice]; }
// Update is called once per frame void Update() { if (!Controller.Instance.paused) { if (transform.position.y < -9f) { BGScroll newV = Instantiate(this, new Vector3(-4, 29.2f, this.transform.position.z), Quaternion.identity); Destroy(this.gameObject); } transform.position += new Vector3(0, -vel, 0); } }