Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

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:
    5
    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.