Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by karl_ · Jun 27, 2011 at 03:27 PM · javascripteditor

Time.deltaTime in Editor script

I've come to realize that Time.deltaTime does not update in an editor script. I need a timed countdown in this particular script. Is there any way to achieve this in editor?

Comment
Add comment · Show 4
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 Kacer · Jun 27, 2011 at 03:38 PM 0
Share

for what reason?, you could add the script to a gameobject that doesnt get destroyed when you load a level and achieve the same effect.

avatar image karl_ · Jun 27, 2011 at 03:42 PM 0
Share

The issue is that when not in play mode, Time.deltaTime does not update. I would like to avoid having to enter play mode every time I use this tool.

avatar image Bunny83 · Jun 27, 2011 at 03:45 PM 0
Share

@$$anonymous$$acer: He's talking about an Editor script, not a $$anonymous$$onoBehaviour at runtime.

avatar image Kacer · Jun 27, 2011 at 03:46 PM 0
Share

ignore me then ^^

2 Replies

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

Answer by Bunny83 · Jun 27, 2011 at 04:02 PM

You could use the Time.realtimeSinceStartup.

 var timeOut : float;
 
 function StartCountdown(seconds : float)
 {
     timeOut = Time.realtimeSinceStartup + seconds;
 }
 
 function Update()
 {
     if (Time.realtimeSinceStartup > timeOut)
     {
         // do something
     }
 }

It's just the basic concept ;)

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
4

Answer by Graham-Dunnett · Jun 27, 2011 at 03:45 PM

http://unity3d.com/support/documentation/ScriptReference/EditorApplication-timeSinceStartup.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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Variable creation through Inspector using CustomEditor? 1 Answer

How to use a global variable in javascript to set other variables data 0 Answers

Accessing OnSceneGUI with EditorWindow in JS 1 Answer

What is a good Javascript editor, with Syntax highlighting and checking? 5 Answers

JavaScript issue: apparently invisible variables 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