unity time deltatime code example

Example 1: unity deltatime

using UnityEngine;
// Rotate around the z axis at a constant speed
public class ConstantRotation : MonoBehaviour
{
    public float degreesPerSecond = 2.0f;
    void Update()
    {
        transform.Rotate(0, 0, degreesPerSecond * Time.deltaTime);
    }
}

Example 2: unity time.deltatime timescale 0

//replace "Time.deltaTime" to this
Time.unscaledDeltaTime

Example 3: time.time unity

/*The time at the beginning of this frame (Read Only). This is the time in
  seconds since the start of the game.

  Time.time is the amount of time in seconds that the application has been
  running for. It is read-only.

  The application receives the current Time.time at the beginning of each frame,
  with the value increasing per frame. A time call per frame receives the same
  value. When called from FixedUpdate it returns the Time.fixedTime property.

  Regular (per frame) calls should be avoided: Time.time is intended to supply
  the length of time the application has been running for, and not the time per
  frame.

  The value of Time.time is undefined during Awake messages and will start after
*/all messages are finished.
//Ex.:

int time = Time.time; //the variable time has a value equals to the
//amount of time in seconds that the application has been
//running for.