title: How to make Unity UI object draggable when the objects are instantiating at runtime?
body: <p>I am working on a management game where every user has some specific characters in save files. I am instantiating these characters inside a panel, I want the user to choose one of the cards and drag it to some specific point. I am able to make a drag script for the object that is already in a scene. But how to achieve the same thing if objects are generating at runtime?
  I just need some idea how to do it.
  here's my current code to drag UI object.</p>
  
  <pre><code>    public void OnDrag(){
      btn.transform.position = Input.mousePosition;
  }
  public void EndDrag(){
      if (btn.transform.position.x -500 &lt;50 || btn.transform.position.x -500 &gt; -50) {
          //btn.transform.position = new Vector3 (-10, 10);
          rt.anchoredPosition = new Vector3 (500, 100, 0);
      }
      else{
          rt.anchoredPosition = new Vector3 (-10, -10, 0);
      }
  }
  </code></pre>