Growth Cube

Hello!

Today I’m trying to make a cube grow taller (Not wider) over a certain amount of time using this script, but it doesnt seem to be doing anything…

Anyone think they could help? Thanks! :smile:

var MaxTotal = 3;
var GrowthSpeed : float = 0.5;

if (transform.localScale.x < MaxTotal)
{
	transform.localScale += Vector3(0.01,0.01,0.01) * Time.deltaTime * GrowthSpeed;
}

You need to put the growing bit in an Update() function, otherwise it’ll only get called once.

How would one accomplish this? I’ve only just recently started Javascripts :stuck_out_tongue:

The short answer is to stick it inside this:

function Update() {

}

But that alone won’t help yo
There’s a bunch of tutes to get you started. Running through them will be far more useful than one-off answers. Start here: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn

Thank you good sir! :slight_smile: