Erroe when resizing GUITextures in C# file

Hi guys,

I have an in-game store that uses GUITexture objects for the UI buttons. This is the relevant code, from GameStore.cs:


public class GameStore : MonoBehaviour {
	public GUITexture storeButton;
	public GUITexture oneUseButton;
	public GUITexture fiveUseButton;
	public GUITexture tenUseButton;
	public GUITexture twentyUseButton;


void Awake () {
		// Resize images to 1/2 size on non-retina devices

		storeButton.transform.localScale = Vector3(0.5, 0.5, 0.5);
		oneUseButton.transform.localScale = Vector3(0.5, 0.5, 0.5);
		fiveUseButton.transform.localScale = Vector3(0.5, 0.5, 0.5);
		tenUseButton.transform.localScale = Vector3(0.5, 0.5, 0.5);
		twentyUseButton.transform.localScale = Vector3(0.5, 0.5, 0.5);


The code is supposed to draw the GUITextures at 1/2 their length and width when displayed on a non-retina iOS device (iPhone 3GS, 1st and 2nd-gen iPad, iPad Mini), but the code instead results in the following error:

error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected

The standard fix is to use the term “new” somewhere, but I’m not sure how it applies here (since the public variables are set in the inspector). What should I do?


This line is okay in uJS:

storeButton.transform.localScale = Vector3(0.5, 0.5, 0.5);

But in C#, it should be:

storeButton.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);