Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to have a count down timer carry over to a new level?

Discussion in 'Scripting' started by chrishall, Jun 8, 2014.

  1. chrishall

    chrishall

    Joined:
    Apr 8, 2013
    Posts:
    9
    Hi there I am currently creating a 2D game where you have to collect X amount of objects in X amount of time. I want to have a ten second timer as a GUI Label. But I don't want it to be restated when I change levels. So I want the timer, let's say in the top right hand corner at all times counting down even when I change levels! Is this possible? Would I use something like DontDestoryOnLoad? scripting is not my thing! Any help would be greatly appreciated!
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Scripting will have to sort of be your thing for this. Use playerprefs or dontdestroy as you suggested.
     
  3. chrishall

    chrishall

    Joined:
    Apr 8, 2013
    Posts:
    9
    Thanks that still does not really help.
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Perhaps you could consider playmaker if you wanted to make game elements without programming.
     
  5. Ian094

    Ian094

    Joined:
    Jun 20, 2013
    Posts:
    1,548
    Or you could just simply add :
    Code (JavaScript):
    1. DontDestroyOnLoad(this.gameObject);
    to your timer script.
     
  6. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226