title: C# converting type double to float
body: <p>I'm new to C#, and I can't work out why I'm getting the following error on these lines of code. </p>
  
  <blockquote>
    <p>"error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)"</p>
  </blockquote>
  
  <pre><code>float rightEdgeOfFormation = (float) transform.position.x + (width * 0.5);
  float leftEdgeOfFormation = (float) transform.position.x - (width * 0.5);
  </code></pre>
  
  <p>I thought writing (float) was the cast?</p>
  
  <p>Thanks so much!</p>