how to make script wait for some seconds in EditorWindow class (c#)

hi there!

is there any way to make a EditorWindow script wait for some seconds?

i want a message to show up for three seconds, but since it is no MonoBehaviour neither “StartCoroutine()” nor “yield return new WaitForSeconds” inside a “IEnumerator” seems to work.

thnx!

The EditorWindow class has an Update() method that gets called 100 times per second (Ref: EditorWindow.Update()). 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
			}
		}
	}
}