Search Unity

[SOLVED] Getting Elasped Time - C#

Discussion in 'Scripting' started by cyangamer, Mar 7, 2010.

  1. cyangamer

    cyangamer

    Joined:
    Feb 17, 2010
    Posts:
    234
    Hi, another question. I know the Time functions return the time since the game started, but is there a function that returns the time in an interval? Essentially, I need a Time.time function that's able to record time starting from a point of my choosing. How do I do this?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Code (csharp):
    1. startTime = Time.time;
    Followed by

    Code (csharp):
    1. elapsedTime = Time.time - startTime;
    --Eric
     
  3. cyangamer

    cyangamer

    Joined:
    Feb 17, 2010
    Posts:
    234
    Thanks. SHould've known that, but then again, it is pretty late. :)