How can I change the pixelInset.width of a GUITexture in C#?

It works in js but not in C#

fuelbar.pixelInset.width = (fuelbarStartingWidth * (fuelAmount * 0.01F));

error CS1612: Cannot modify a value type return value of `UnityEngine.GUITexture.pixelInset’. Consider storing the value in a temporary variable

pixelInset is a Rect class object. you cannont directly change the value of an object for vector2, vector3 or rect in C#. The reason is that it makes the execution slow. so if you want to change a value in any of the above type you got to do it like the below.

fuelbar.pixelInset = new Rect(fuelbar.pixelInset.x,fuelbar.pixelInset.y, (fuelbarStartingWidth * (fuelAmount * 0.01F),fuelbar.pixelInset.height);

same for changing position in c# tranform.position is a vector3 you cannot change the value like transform.postion.x = 6f;, you either have to create a temp variable and assign the value to the earlier or use new Vector3().