I want it to grow! Then vanish

Howdy all!

Ok so I have been trying to no avail to get an instantiated game object to grow at a consistent rate ( ie a balloon inflating rapidly ) and then vanish ( i would use destroy gameobject ). Any help here would be GREATLY appreciated.
Thanks a ton!

-Richard

Coroutine… One word will help you out here.

A coroutine is a process that runs beside the game. Every time you yield, you wait one or more frames. This means that each frame you can “grow” an object by a number based on Time.deltaTime. With that you can consistently grow an object, then if it reaches over a certain size, destroy it.

psuedocode:

Start(){
	myCoroutine();
}

myCoroutine(){
	maxSize = 5.0
	growthRate = 1.0
	scale = 1.0
	while(true){
		transform.localScale = vector3.one * scale
		scale += growthRate * Time.deltaTime
		if scale > maxSize then break
		yield
	}
	Destroy(gameObject)
}

Wow. Thanks for the quick answer! I will start tooling around with this right now. Appreciate it. If you find yourself in the Houston area the first round is on me.

-Richard

Ok. So now I get this error, "unknown identifier “vector3”

My bad. capitalized “V”