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 Zypher · Jun 07, 2014 at 12:37 AM · timergameover

Display Time At Game Over Scene

I have this time script:

 #pragma strict
 private var startTime : float;
 var textTime : String;
 //First define two variables. One private and one public variable. Set the first variable to be a float. 
 //Use for textTime a string. 
 function Start() {
 startTime = Time.time;
 }
 function OnGUI () {
 var guiTime = Time.time - startTime; 
 //The gui-Time is the difference between the actual time and the start time.
 var minutes : int = guiTime / 60; //Divide the guiTime by sixty to get the minutes.
 var seconds : int = guiTime % 60;//Use the euclidean division for the seconds.
 var fraction : int = (guiTime * 100) % 100;
  
  textTime = String.Format ("{0:00}:{1:00}:{2:00}", minutes, seconds, fraction); 
 //text.Time is the time that will be displayed.
  GetComponent(GUIText).text = textTime;
  
 }


Stars all falling and the player's job is to destroy the stars by touching them and they cannot let one pass or they will lose the game. The score system is basically the time; how long they last. But, I'm having trouble with creating a game Over trigger and displaying the player's highest time in the Game Over scene. How do I do it?

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 oasisunknown · Jun 07, 2014 at 03:44 AM 0
Share

this is the best reference I have at the moment.

Austin was talking in earlier videos about making this score system based off time but he changed it in the end to make it based off points. but he does show how to open a window and add fields to it for score. so it may help you with the basics of creating the window and feeding information to it. just change his score to your time.

https://www.youtube.com/watch?v=Wb80$$anonymous$$BoqxBQ∈dex=8&list=PLivf$$anonymous$$P2ufI$$anonymous$$7RuAtL0O9ay5z9ZL2GbGlI

good luck. I hope someone can help you with more information.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DecipherOne · Jun 07, 2014 at 03:53 AM

Count the seconds, then convert them into your other values, the game over trigger would be a boolean triggered when your game over condition was met and then load a different state somehow.

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 Zypher · Jun 07, 2014 at 08:56 PM 0
Share

Will the boolean trigger require another script?

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

23 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

Related Questions

Display Time At Game Over Scene 2 Answers

How can I display the GAME OVER word across the centre of the screen when the when my timer hits zero? 3 Answers

Time Score? 1 Answer

How to restart a level with countdown? 4 Answers

Issue with Timed Shooting in C# 1 Answer


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