Cysharp/MessagePipe

Unable to add UDP interprecess messaging in Unity 2020.3

slimshader opened this issue · 2 comments

Hi,

just tried the support for UDP Interprocess in regural C# console app and all worked well but there is a problem when trying to make it work in Unity <-> Unity 2020.3 using Zenject.

  1. There is no way to actually call "AddMessagePipeUdpInterprocess" for the DiContainer as the overload only extends IServiceCollection and only proxy for DiContainer - DiContainerProxy is marked "internal"

  2. Looks that "AddMessagePipeUdpInterprocess" does not actually register "IDistributedPublisher<> and IDistributedSubscriber<>" when Unity version is above 2018:

#if !UNITY_2018_3_OR_NEWER
            services.Add(typeof(IDistributedPublisher<,>), typeof(UdpDistributedPublisher<,>), options.InstanceLifetime);
            services.Add(typeof(IDistributedSubscriber<,>), typeof(UdpDistributedSubscriber<,>), options.InstanceLifetime);
            return services;
#else

Update: I've figured out 2 and now it all works fine, Zenject installer,:

        var options = Container.BindMessagePipe();
        var services = new DiContainerProxy(Container);
        var udpOptions = services.AddMessagePipeUdpInterprocess("127.0.0.1", 3456);
        services.RegisterUpdInterprocessMessageBroker<int, string>(udpOptions);

still, not sure about 1) tho

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.