Get object name from raycast.

Hey. I'm trying to get a gameobject's name using raycast, and set it to a var. But exexuting the code give me the error "(11,41): BCE0034: Expressions in statements must only be executed for their side-effects."

Heres my code.

public var myNewTexture2D:Texture2D;

function Update ()
   if ( Input.GetMouseButtonDown(1) )
      var hit : RaycastHit;
      var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
      if (Physics.Raycast (ray, hit, 100.0))
         renderer.material.mainTexture = myNewTexture2D; 
         renderer.material.SetColor ("_SpecColor",;

Just putting a variable on a line by itself generates that error.

You need to assign something to it or assign it to something. :)