Search Unity

How to make a Cancel button for an editor script ?

Discussion in 'Scripting' started by Steven-1, Jan 5, 2013.

  1. Steven-1

    Steven-1

    Joined:
    Sep 11, 2010
    Posts:
    471
    I'm making an EditorWindow script, and I would like to make it cancelable by having a cancelbutton in the window when it's dooing it's stuff.
    But so far I can't seem to find a way to do this.
    I thought I could use StartCoroutine() en WaitForSeconds() to make the user have a chance to press the cancel button, but you can only use that in MonoBehaviours apparently.

    I searched for this but I can't seem to find a solution.

    And I can't believe that it's not possible
    (or at least I don't want to :()
     
    radiantboy likes this.
  2. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Did you ever find out how? I need this too.
     
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Can't you have the Coroutine on the monobehaviour and call it though the editor scripts .target variable?

    this was my gut instinct too.
     
  4. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I dont think so, not without running the game anyway?
     
  5. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    this is nice..
    isRunning = !EditorUtility.DisplayCancelableProgressBar("hello", progressBarMessage, progressBar);
     
    SparrowGS likes this.