Time since object was instantiated?

I want to scale an object based on how old it is. I’m sure there’s a simple way to do this, but I don’t see it…?? Thanks for any assistance :slight_smile:

when you create your object, you can store its creation time… create a script and add it to the object, then use:

var startTime : float;

function Awake(){
  startTime = Time.time;

now that you have stored the creation time, you can see how long it has been around using:

Time.time - startTime

however, if all you want is for your object to get bigger over time, all this is overkill… for example, to scale consistently over time, you could just say something like:

var scaleSpeed : float = 0.1;

function Update(){
  transform.localScale += Vector3(scaleSpeed,scaleSpeed,scaleSpeed) * Time.deltaTime;

or to scale up periodically:

function Awake(){

function ScaleUp(){
  transform.localScale += Vector3(scaleSpeed,scaleSpeed,scaleSpeed);

You can capture the current gametime in the object’s Start(), and then compare it against the current gametime in Update():

private float initializationTime;

void Start () {
    initializationTime = Time.timeSinceLevelLoad;

void Update () {
    float timeSinceInitialization = Time.timeSinceLevelLoad - initializationTime;

If you want realtime elapsed instead of gametime replace Time.timeSinceLevelLoad Time.realtimeSinceStartup.

Thank you. :slight_smile: (Still new to this.)