using System.Collections; using System.Collections.Generic; using UnityEngine; public class HMRandom : MonoBehaviour { float x,y; // Use this for initialization void Start () { x = Random.Range(-1.4f, 1.4f); y = 2.5f; this.transform.position = new Vector3(x, y, 0); } // Update is called once per frame void Update () { y -= 0.01f; if (y < -2.5f) { x = Random.Range(-1.4f, 1.4f); y = 2.5f; } this.transform.position = new Vector3(x, y, 0); } }