title: Why is Vector3 not updating Unity3d
body: <p>I have been losing my sanity on this for a while now. Just disregard the part which is commented out (Not the problem). I am trying to do a 360 degree longitude and 180 degree longitude sweep and then raycast. But apparently the direction vector (Dir in this case) is stuck at (0, 0, -1). I checked the x y and z values and they are working fine. I have no idea now what is wrong. Please answer before I kill myself. <em>sigh</em></p>
  <pre><code>    {
          Vector3 Dir = new Vector3(0.0f, 0.0f, 0.0f);
          Output = new Texture2D(2160, 1080);
          for (int i = 0; i &lt; 1080; i++)
          {
              float theta = (Mathf.Deg2Rad * i * 1.0f) / 6.0f;
              for (int j = 0; j &lt; 2160; j++)
              {
                  float phi = (Mathf.Deg2Rad * j) / 6.0f;
                  float x = Mathf.Sin(theta) * Mathf.Cos(phi);
                  float y = Mathf.Sin(theta) * Mathf.Sin(phi);
                  float z = Mathf.Cos(theta);
                  Dir = new Vector3(x, y, z);
                  Debug.Log(x + &quot; &quot; + y + &quot; &quot; + z);
                  /* RaycastHit raycastHit;
                  if (Physics.Raycast(transform.position, Dir, out raycastHit))
                  {
                      Renderer rend = raycastHit.transform.GetComponent&lt;MeshRenderer&gt;();
                      Texture2D tex = rend.material.mainTexture as Texture2D;
                      Vector2 pCoord = raycastHit.textureCoord;
                      pCoord.x *= tex.width;
                      pCoord.y *= tex.height;
                      Color color = tex.GetPixel((int)(pCoord.x * rend.material.mainTextureScale.x), (int)(pCoord.y * rend.material.mainTextureScale.y));
                      Output.SetPixel(j, i, color);
                      Debug.Log(&quot;Ray hit an object! @  theta &quot; + i.ToString() + &quot; phi &quot; + j.ToString() + &quot; Color: &quot; + color.ToString() + &quot;Hit Coordinate x: &quot; + pCoord.x + &quot; y: &quot; + pCoord.y);
                  }
                  */
              }
          }
          //System.IO.File.WriteAllBytes(&quot;D:\\FYProject\\WebcamSnaps\\&quot; + naming + &quot;.png&quot;, Output.EncodeToPNG());
      }
  </code></pre>