- Home /
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
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.
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.
@$$anonymous$$acer: He's talking about an Editor script, not a $$anonymous$$onoBehaviour at runtime.
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 ;)
Your answer
