Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

2020.a14 breaks 3rd party editor dll

Discussion in '2020.1 Beta' started by Hyeongjik, Nov 27, 2019.

  1. Hyeongjik

    Hyeongjik

    Joined:
    Mar 8, 2016
    Posts:
    4
    in Unity 2020.1a14 changelog:
    ..
    Editor: Change the type of delayCall to event. (1193566)
    ..
    this breaks many 3rd party editor plugins dll which doesn't provide source code.
    because event type is not compatible with delegate type.

    eg)
    Code (csharp):
    1.  
    2. EditorApplication.delayCall += ()=>{};
    3.  
    this code compiles to dll like below.

    - before a14
    Code (csharp):
    1.  
    2. EditorApplication.delayCall = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.delayCall, new EditorApplication.CallbackFunction(delegate(){});
    3.  
    - after a14
    Code (csharp):
    1.  
    2. EditorApplication.delayCall += delegate(){};
    3.  
    so, compiled dll before a14 is not compatible with a14.


    is this confirmed breaking change?
    if so, many editor plugins from Asset Store will be broken.
     
  2. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi,

    Do you have a concrete example of this change breaking a 3rd party plugin? From my point of view it should be fine, but if you have a sample project for which this occurs, please report a bug and we'll look at it.

    Doing "EditorApplication.delayCall =" was wiping all previously concanated delayCall. So it was wrong to do that before.
     
    Last edited: Nov 28, 2019
    Xarbrough and karl_jones like this.
  3. lochrist

    lochrist

    Joined:
    Sep 29, 2017
    Posts:
    6
    Do you have a plugin example that will be affected by this? We want to test it before applying a patch.

    Thanks

     
  4. Hyeongjik

    Hyeongjik

    Joined:
    Mar 8, 2016
    Posts:
    4
    Plugin with source code is not a problem.
    but plugin with dll got an error.

    For example,

    Console Enhanced Free
    https://assetstore.unity.com/packages/tools/utilities/console-enhanced-free-42381

    Console Enhanced Pro
    https://assetstore.unity.com/packages/tools/utilities/console-enhanced-pro-11521

    this plguin emits error since 2020.1.a14.

    Code (csharp):
    1.  
    2. System.MissingFieldException: Field 'UnityEditor.EditorApplication.delayCall' not found.
    3.   at ConsoleE.InitModule..cctor () [0x0000d] in <c901d572ddfe48e086fb06681e2c9911>:0
    4. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
    5.  
    of course, doing "EditorApplication.delayCall =" is wrong usage.
    but if you build dll with a code like "EditorApplication.delayCall += ()=>{}" before 2020.1.a14, and decompile it.
    decompiled source shows
    EditorApplication.delayCall = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.delayCall, new EditorApplication.CallbackFunction(()=>{}));
    it is compiled not using += but using Delegate.Combine
     
    Last edited: Nov 29, 2019
  5. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Yep, actually we will revert the change and maybe over time mark it as deprecated to give some time for plugins to update themselves.

    Next release should bring back the preivous delayCall signature.

    Thanks for the feedback.
     
    SugoiDev likes this.