Search Unity

The order in which UnityEvents are invoked

Discussion in 'UGUI & TextMesh Pro' started by hessel_mm, Dec 19, 2014.

  1. hessel_mm

    hessel_mm

    Joined:
    Mar 12, 2014
    Posts:
    44
    I've noticed (and by digging into the assembly I got my observations confirmed) that the listeners in a UnityEvent are called in the same order as they appear in the inspector UI. I actually quite like this, but I don't get why items in the list aren't draggable (especially since it seems to use the UnityEditorInternal.ReorderableList)...

    Is it because the order of the calls to listeners is not guaranteed and might be subject to change in the future, or is it a valid request to want the list to be reorder-able? :)
     
  2. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    It was reorderable during the beta i think (maybe earlier) but was removed because its not guaranteed.
     
  3. Xaurrien

    Xaurrien

    Joined:
    Jul 2, 2012
    Posts:
    20
    Hi @phil-Unity, thanks for your answer.

    Do you know if it will be guaranteed one day ?
    It's a pretty useful feature to call methods in a specific order when an event is fired.
     
  4. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    from my understanding at least we wont ever be able to 100% guarantee it. but i'm pretty sure in 95% of the cases it will be the proper order. (think one platform or something does something weird).
     
  5. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    Bumping this thread...

    Is there any updates on the ability to reorder the list?
     
  6. Nexer8

    Nexer8

    Joined:
    Dec 10, 2017
    Posts:
    271
    OK, so it has been ~6 years. Could we perhaps get an attribute that makes it reorderable?