do a transform on an Object, need basic help on C#

hello Forum,
oh how i hate to annoy you with my newbie questions. I am working through the C# tutorial on the unifycommunity.com/wiki and do researches on regular Wikipedia, but it doesn’t tell me how to transform an Object in Unity.

So what in JavaScript would look like this (attached to an Ojbect):

function Update () {

	transform.localScale.y = 30;

}

i tried in C#. But it doesn’t work, what’s missing?:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {
	
	// Update is called once per frame
	void Update () {
	
		transform.localScale.y = 30;
	
	}
}

Try this:

transform.localScale = new Vector3(transform.localScale.x, 30, transform.localScale.z);

This will set the y scale to 30 while keeping the x and z scale the same.

Thanks Matthew. If anyone is like me, I also have to know the “WHY?”
For my fellow noobs, allow me to attempt this one, and regurge something I’m just learning…

The localScale variable is of type Vector3 (struct), but is actually a different type of member called a “property”. (Refer to C# docs for the details of C# “properties”). As has been mentioned in other posts, you have to write to this a special way - using a whole struct. In other words, you can’t ‘directly’ write to one individual struct member.