Can Someone Convert this to C#

Hi I got this code working fine from the forums but Ive been studying along with C# I tried converting this myself but It doesnt work, I’m still a newbie I hope you can help me, thanks in Advance.

this code is used to make an object follow the mouse cursor in world space by putting this code to the object you want to follow the cursor.

#pragma strict

var depth = 10.0; 

 

function Start () 

{ 

     Screen.showCursor = true; 

} 

 

function Update () 

{ 

     var mousePos = Input.mousePosition; 

     var wantedPos = Camera.main.ScreenToWorldPoint (Vector3 (mousePos.x, mousePos.y, depth)); 

     transform.position = wantedPos; 

}
public class ClassName : MonoBehaviour{
float depth = 10.0; 
void Start () 
{ 
     Screen.showCursor = true; 
} 
void Update () 
{ 
     Vector3 mousePos = Input.mousePosition; 
     Vector3 wantedPos = Camera.main.ScreenToWorldPoint (new Vector3 (mousePos.x, mousePos.y, depth)); 
     transform.position = wantedPos; 
}
}

Works Perfect man!! the Vector3 is what I’m not really sure of when I’m trying to convert this, Thanks a lot :slight_smile:

No problem