Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Questions about coroutine and uGUI events

Discussion in 'UGUI & TextMesh Pro' started by Cherami, Aug 27, 2014.

  1. Cherami

    Cherami

    Joined:
    Jul 3, 2014
    Posts:
    4
    Hi uGui devs!

    I made a jpg for a better comprehension, but i wrote also my questions below :

    I want to use a custom function "public IEnumerator FadeInScene()", with OnClick() event. When i put the script on the OnClick() object field, Unity doesn't propose this function. Is it possible to call an IEnumerator function, or use StartCoroutine with the function field? For the moment, i created an additional void function which call IEnumerator function by StartCoroutine. It works, but i find easier to call IEnumerator function directly in Inspector.

    Another question : Is it possible to wait a moment before calling others events? For example, switch between 2 UI after a fadein scene (which lasts 1 second)

    Thanks for answers

    questions ugui events.jpg
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    All the events are invoked simultaneously. The order is undefined. The UnityEvents are implemented on top of regular delegates, so have the same limitations.
     
  3. Cherami

    Cherami

    Joined:
    Jul 3, 2014
    Posts:
    4
    Thanks for the quick answer!