title: How do i make enemy move from top to bottom of screen in unity c#?
body: <p>I'm trying to create a 2D space shooter type game using unity, but I can't seem to make the spawned enemies move from the top to the bottom of the screen, I'm actually new to unity and c#, and I can't figure out what is wrong with my code.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class EnemyControl : MonoBehaviour {
  
  float speed;
  // Use this for initialization
  void Start () {
      speed = 2f;
  }
  
  // Update is called once per frame
  void Update () {
      Vector2 position = new transform.position;
  
      position = new Vector2(position.x, position.y - speed * Time.deltaTime);
  
      transform.position = position;
  
      Vector2 min = Camera.main.ViewportToWorldPoint(new Vector2(0, 0));
  
      if(transform.position.y &lt; min.y) {
      Destroy(gameObject);
      }
  }
  </code></pre>