Javascript to C# Question

How do i go about fixing this in C#? How do I set the pixelInset?

gui.pixelInset.x = touch.position.x; gui.pixelInset.y = touch.position.y;

And what's wrong with this in C#?

gui = GetComponent(GUITexture);

You can't modify structs returned from a function/property, so you need to assign to a temporary and update it

Rect inset = gui.pixelInset;
inset.x = touch.position.x;
inset.y = touch.position.y;
gui.pixelInset = inset;

For the component thing, you need to cast it to the right type, or use the generic version

gui = GetComponent<GUITexture>();


gui = (GUITexture)GetComponent(typeof(GUITexture));