title: How to get position of every instantiated GameObject Unity 2D
body: <p>I am newbie, trying to make a simple tap-to-jump type 2D game, I was able to figure out things on my own but I can't do anything with this problem. 
  So the problem is:- 
              1). I have three scripts Movement.cs, Obstacle.cs, and Score.cs (both Movement.cs and Score.cs are attached to "Player" gameObject). </p>
  
  <p>2). In Score.cs I want to score++ every time the player jumps and avoid collision with obstacle (just like flappy bird). </p>
  
  <p>3) Here is my Score.cs script:
   I include snippet because of "code not formatted" error
  <div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>using UnityEngine;
  using System.Collections;
  
  public class Score : MonoBehaviour 
  {
   public GameObject obstacle;
   public Obstacle obs;
   public int score;
  
   void Start () 
   {
    obstacle = GameObject.Find("Crate");
    obs = obstacle.GetComponent&lt;Obstacle&gt;();
   }
  
   void Update () 
   {
    if (obs.transform.position.x &lt;= transform.position.x);
    {
     score++;
     Debug.Log (score);
    }
    Debug.Log (score);
   }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Above mentioned script is generating following error</p>
  
  <p>MissingReferenceException: The object of type 'Obstacle' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.</p>
  
  <p>What I discover is that, that "obs.transform.position.x" is giving the position of original prefab and not the position of copy it is generating(I observe it when I use Debug.Log(obs.transform.position.x)).</p>
  
  <p>4). My Obstacle.cs script is:</p>
  
  <p>Again for the same reason I include snippet.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>using UnityEngine;
  using System.Collections;
  
  public class Obstacle : MonoBehaviour {
  
   public GameObject crate;
   //public GameObject clone;
   public float t = 1f;
   public int score = 0;
   public float startingPositionX = 2.53f;
   public float startingPositionY = -3.50f;
  
   void Start () 
   {
    Invoke ("Generate", t);
   } 
  
   void Update()
   {
    var x = -6f;
    var y = 0f;
    rigidbody2D.velocity = new Vector2 (x, y);
    //Debug.Log(clone.transform.position.x);
  
    /*if(clone.transform.position.x == -9.53f)
    {
     score++;
     Debug.Log(score);
    }*/
  
    Destroy (crate, 3.0f);
   }
  
   void Generate()
   {
    /*clone = */Instantiate (crate, new Vector3 (startingPositionX, startingPositionY, 0f), Quaternion.identity); 
   }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I tried assigning "clone" the copy of my crate prefab and doing the score thing in my Obstacle.cs script but it also didn't worked.</p>
  
  <p>5). Now I am unable to increase score by 1 because of the above mentioned errors and problems, funny part is that my score is increasing like number of frames per second.  </p>
  
  <p>Phew! that's all I hope you guys can understand my problem and provide me solution. Question is very little but I thought I should explain it and make it as clear as I can. </p>