title: Convert Vector3 to float in Unity
body: <pre><code>using UnityEngine;
  using System.Collections;
  public class GetPosition : MonoBehaviour
  {
      Vector3 dragStartPosition;
      float dragStartDistance;
      float[] Xfloat;
  
      void OnMouseDown()
      {
          dragStartPosition = transform.position;
          dragStartDistance = (Camera.main.transform.position - transform.position).magnitude;
      }
  
      void Update()
      {
      }
  
      void OnMouseDrag()
      {
              Vector3 worldDragTo = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, dragStartDistance));
              transform.position = new Vector3(worldDragTo.x, dragStartPosition.y, dragStartPosition.z);
              new Vector3(worldDragTo.x, dragStartPosition.y, dragStartPosition.z);
              float Newpos = ;
      }
  
      void OnMouseUp()
      {
      }
  
  }
  </code></pre>
  
  <p>I have this code in unity and I would like to convert my new Vector3 (only position x) to a float, how can I do this?</p>