I tried Starting a simple coroutine using a button created with the new UI system, but everytime I have a yield in my fuction it stop appearing in the button’s function selector drop down menu in the inspector, the coroutine is a really simple :
while(true) { do something; yield }
Is there something special i need to do or is it just impossible to start a coroutine with a button using the new UI system ?
Simple workaround, works like a charm, thanks !
– MekanofreakAs a side note you may know but in case, if you wish to prevent multiple calls. private bool isRunning = false; public void Wrapper(){ if(isRunning == false){ StartCoroutine(MyCoroutine()); } } private IEnumerator MyCoroutine(){ isRunning = true; // Do your stuff over multiple frames yield return null; isRunning = false; }
– fafaseI know that this is old but i would be glad if you can tell me how can i attach a this to a button
– Chino_96