Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Mar 06, 2014 at 07:45 AM by robertbu for the following reason:

Duplicate Question

avatar image
0
Question by Sam Mbois · Mar 06, 2014 at 07:35 AM · car gametimer-script

CountDown Timer in 2D

hi, I'm new to C# and unity 2D. I'm making game like hill climb racing, and I'm stuck in making countdown timer. In my game, player will game over when time is over.

any ideas?

Thanks, Tio.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image haim96 · Mar 06, 2014 at 07:37 AM 0
Share

in which part did you stuck? creating a timer or showing it?

avatar image highpockets · Mar 06, 2014 at 07:45 AM 1
Share

Well, give it a try and then show your code in a question here if you get stuck, but the way you are asking the question now is like you want someone to code your timer for you..

There are a number of ways that you can approach a timer, in my personal opinion, I think a coroutine would be a good option:

https://docs.unity3d.com/Documentation/ScriptReference/Coroutine.html http://docs.unity3d.com/Documentation/$$anonymous$$anual/Coroutines.html

Start the coroutine in the start function and you can use:

 yield return new WaitForSeconds(1);

within a while loop to make it repeat your code every second, which could be a gui text countdown.. Anyways, good luck

avatar image Sam Mbois · Mar 17, 2014 at 04:56 AM 0
Share

Thanks for answer, but I have solved this problem. thankyou :)

2 Replies

  • Sort: 
avatar image
1

Answer by PvTGreg · Mar 06, 2014 at 07:42 AM

simple google search and i found this http://answers.unity3d.com/questions/225213/c-countdown-timer.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by ejpaari · Mar 06, 2014 at 07:44 AM

This question has been asked quite many times. See for example the following questions

  • Count Down Timer.

  • Countdown Timer

  • C# countdown timer

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sam Mbois · Mar 17, 2014 at 04:56 AM 0
Share

Thankyou :)

avatar image LDev77 · Feb 18, 2015 at 05:45 PM 0
Share

Actually, you can just use a simple timer script. using UnityEngine; using System.Collections; public class Whatever: $$anonymous$$onobehaviour { public float time = 100f; void Update() { time = time - Time.deltaTime; // This is the main part of the timer! Debug.Log("Time: "); Debug.Log(time); // Timer is initiated (whatever that means) } }

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

adding hours in minute and seconds script? 1 Answer

i need the animation to be trigger on a specific time but it is not trigger, script got no error. Not sure where is the problem, need help please. 1 Answer

Change Float Value 1 Answer

jcar script help here ... 0 Answers

How do you make it so that pressing an on-screen button "presses" a key in C#, Unity 5.1.1f? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges