2020.a14 breaks 3rd party editor dll

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)

EditorApplication.delayCall += ()=>{};

this code compiles to dll like below.

  • before a14
EditorApplication.delayCall = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.delayCall, new EditorApplication.CallbackFunction(delegate(){});
  • after a14
EditorApplication.delayCall += delegate(){};

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.

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.

2 Likes

Do you have a plugin example that will be affected by this? We want to test it before applying a patch.

Thanks

Plugin with source code is not a problem.
but plugin with dll got an error.

For example,

Console Enhanced Free

Console Enhanced Pro

this plguin emits error since 2020.1.a14.

System.MissingFieldException: Field 'UnityEditor.EditorApplication.delayCall' not found.
  at ConsoleE.InitModule..cctor () [0x0000d] in <c901d572ddfe48e086fb06681e2c9911>:0
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])

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

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.

1 Like