title: Vectrosity insert prefabs with position
body: <p>I'm currently using Vectrosity to my unity app. I draw lines with touch gestures. Now I would like to insert a text input field at the middle of the created line. Here is my code : </p>
  
  <pre><code>using UnityEngine.UI;
  
  public class DrawLinesTouch : MonoBehaviour {
      public Text _Console;
  
  
      public Texture2D lineTex;
      public float lineWidth = 4.0f;
      public Texture2D capTex;
  
      private VectorLine newLine;
      private Vector2 previousPosition;
      private int sqrMinPixelMove;
      //private bool canDraw = false;
      private Touch touch;
      private int _lineIndex;
  
      public Transform _monCanvas;
      public Transform textfieldPrefab;
  
  
      void Start () {     
          VectorLine.SetEndCap ("flech", EndCap.Mirror, -1.0f, -1.0f, 1.0f, 1.0f, lineTex, capTex);
          _lineIndex = 0;
          SetLine ();
      }
  
      void SetLine() {
          newLine = new VectorLine("line_"+_lineIndex.ToString(), new List&lt;Vector2&gt;(),lineTex, lineWidth, LineType.Discrete, Joins.None);
          newLine.endCap = "flech";
          _lineIndex++;
      }
  
      void Update () {
          if (Input.touchCount &gt; 0) {
              touch = Input.GetTouch (0);
              if (touch.phase == TouchPhase.Began) {
  
  
                  SetLine ();
  
  
                  newLine.points2.Add (touch.position);
  
                  if (newLine.points2.Count == 1) {
  
                      newLine.points2.Add (Vector2.zero);
  
                      _Console.text = newLine.points2.Count.ToString();
  
                  }
              } 
  
              if (newLine.points2.Count &gt;= 2 &amp;&amp; touch.phase == TouchPhase.Moved) {
                  _Console.text = "Moved ?";
                  newLine.points2[newLine.points2.Count-1] = touch.position;
                  newLine.Draw();
  
              }
  
  
              if (touch.phase == TouchPhase.Ended) {              
  
                  _Console.text = "Fin de la ligne " + newLine.name;
  
                  Transform dimValue = (Transform) Instantiate(textfieldPrefab, new Vector2(?????), Quaternion.Euler(0, 0, 0));
  
                  dimValue.transform.SetParent (_monCanvas, false);
  
  
  
              }
          }
  
      }
  
  
  }
  </code></pre>
  
  <p>I created a prefab which is Instantiate (line 66), but no idea how to set the text input at the middle of the line. I suppose that I need to get the position and length of the drawn line.</p>
  
  <p>Any idea ? Thanks!</p>