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 /
avatar image
0
Question by UnrealIzzy · Sep 04, 2012 at 07:54 PM · timeclockin-gamedate

In game clock/Time

Hey guys, I am thinking of adding an In-Game-Clock to my game but do not know how. what I am looking to achieve is this:

alt text

But located on the players screen like a Game HUD.

And I want it to be able to change game time e.g 1 min later clock changes... it may be complex but all help would be grateful!

Thank you -Izzy

Comment
Add comment · Show 1
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 AlucardJay · Sep 04, 2012 at 08:10 PM 0
Share

http://answers.unity3d.com/questions/291188/timer-and-gui-text.html

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Griffo · Sep 04, 2012 at 08:05 PM

Create an empty game object, put a GUI Text on it and choose the font you want, If you don't have that font download it from

http://www.1001freefonts.com/3d-fonts.php

Then add the below script, you will need to edit it to your requirements, the below will print the hours minutes and seconds on screen, you can add the day, month and year, plus position it where you want, hope that helps you out.

 #pragma strict
 
 private var dt = Date();
 
 
 function Update () {
 
 var day = dt.Now.Day;
 var month = dt.Now.Month;
 var year = dt.Now.Year;
 var hours = dt.Now.Hour;
 var minutes = dt.Now.Minute;
 var seconds = dt.Now.Second;
 
 guiText.text = hours + " " + minutes + " " + seconds;
 
 }
Comment
Add comment · Show 1 · 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 UnrealIzzy · Sep 04, 2012 at 08:46 PM 0
Share

Thank you man! I have edited the script for now so I can just have the Hours & $$anonymous$$ins :D

private var dt = Date();

function Update () {

var day = dt.Now.Day; var month = dt.Now.$$anonymous$$onth; var year = dt.Now.Year; var hours = dt.Now.Hour; var $$anonymous$$utes = dt.Now.$$anonymous$$inute; //var seconds = dt.Now.Second;

guiText.text = hours + ":" + $$anonymous$$utes; //+ "" + seconds;

}

Thanks again :D

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Accelerate/Decelerate Custom Game Clock 2 Answers

Changing lighting/skybox based on Computer Time? 1 Answer

putting the date into a variable 1 Answer

Accurate millisecond timed thread 2 Answers

Clock Trigger 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