The EditorWindow class has an Update() method that gets called 100 times per second (Ref: [EditorWindow.Update()][1]). You can use this to track time by adding a float member to your EditorWindow subclass and adding 0.01f seconds to it in the Update method.
public class MyEditorWindow : EditorWindow
{
bool m_supposedToCheckTime = false;
float m_time = 0.0f;
...
void Update()
{
if (m_supposedToCheckTime)
{
m_time += 0.01f;
if (m_time >= 3.0f)
{
//make sure you reset your time
m_time = 0.0f;
m_supposedToCheckTime = false;
//TODO: take action
}
}
}
}
[1]: http://unity3d.com/support/documentation/ScriptReference/EditorWindow.Update.html
↧