Skip to main content
Minor formatting
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61

I'm a bit stuck on a delegate error in unityUnity. The code works fine if I'm in a c# console app however unityUnity is giving me a Cannot convert lambda expression to type 'IObserver' because it is not a delegate typethe error.:

Cannot convert lambda expression to type 'IObserver' because it is not a delegate type.

client.ReconnectionHappened.Subscribe(type =>
            {
                Log.Information($"Reconnection happened, type: {type}, url: {client.Url}");
            });

I tried updating to the latest unityUnity for the c# 8 support but that didn't appear to fix anything. I'm guessing it has something to do with .net compatibility and unityUnity. Do I need to create this delegate some other way to be compatible with unity?

I've been looking at the code here. Websockets Server for Unity3d

Using this for the client https://github.com/Marfusios/websocket-client

I'm a bit stuck on a delegate error in unity. The code works fine if I'm in a c# console app however unity is giving me a Cannot convert lambda expression to type 'IObserver' because it is not a delegate type error.

client.ReconnectionHappened.Subscribe(type =>
            {
                Log.Information($"Reconnection happened, type: {type}, url: {client.Url}");
            });

I tried updating to the latest unity for the c# 8 support but that didn't appear to fix anything. I'm guessing it has something to do with .net compatibility and unity. Do I need to create this delegate some other way to be compatible with unity?

I've been looking at the code here. Websockets Server for Unity3d

Using this for the client https://github.com/Marfusios/websocket-client

I'm a bit stuck on a delegate error in Unity. The code works fine if I'm in a c# console app however Unity is giving me the error:

Cannot convert lambda expression to type 'IObserver' because it is not a delegate type.

client.ReconnectionHappened.Subscribe(type =>
            {
                Log.Information($"Reconnection happened, type: {type}, url: {client.Url}");
            });

I tried updating to the latest Unity for the c# 8 support but that didn't appear to fix anything. I'm guessing it has something to do with .net compatibility and Unity. Do I need to create this delegate some other way to be compatible with unity?

I've been looking at the code here. Websockets Server for Unity3d

Using this for the client https://github.com/Marfusios/websocket-client

Source Link

Working with websockets in Unity: Cannot convert lambda expression to type 'IObserver<ReconnectionInfo>' because it is not a delegate type

I'm a bit stuck on a delegate error in unity. The code works fine if I'm in a c# console app however unity is giving me a Cannot convert lambda expression to type 'IObserver' because it is not a delegate type error.

client.ReconnectionHappened.Subscribe(type =>
            {
                Log.Information($"Reconnection happened, type: {type}, url: {client.Url}");
            });

I tried updating to the latest unity for the c# 8 support but that didn't appear to fix anything. I'm guessing it has something to do with .net compatibility and unity. Do I need to create this delegate some other way to be compatible with unity?

I've been looking at the code here. Websockets Server for Unity3d

Using this for the client https://github.com/Marfusios/websocket-client