Wait until mouseclick

Hello,
So I need function which on run first put into the text field “Day 1” and then waits for user to read it and then on click it changes for “Day 2”

Whole code work just fine but StartCoroutine(WaitforClick()); is being completly ignored, So on run it is skipped and I have right away in my text box “Day 2”

Is there any simple way to create function that would wait until mouse button is clicked?

public void newDay(){
bool dayOne = true;
bool dayTwo = true;
    
                                if (dayOne == true) {
                                         dayInfo.text ="Day1";
                                }
    
                  StartCoroutine(WaitforClick());
    
                                if(dayTwo == true{
                                         dayInfo.text = "Day 2";
                                }
    }
    
    
    IEnumerator WaitforClick(){
    
          while(true)
    		{
    			if(Input.GetMouseButtonDown(0))
    			{				
    						yield break;									
    			}
    			yield return null;
    		}
    }

Actually, yes :smiley:

Well, coroutines are a powerful way to do something, but you shouldn’t use them for everything, because of many aspects of high cost… You could make a simple call in Update like:

void Update(){
    if(Input.GetKeyDown(0)){
        NextDay();
    }

void NextDay(){
    daysCount++;
    dayInfo.text = "Day "+daysCount;
}

this way you could achieve the same result, keep going until the end of our days :confused: and don’t use coroutines :smiley: