static VisualStudioIntegration() { if (!VisualStudioEditor.IsEnabled) { return; } RunOnceOnUpdate(() => { // Despite using ReuseAddress|!ExclusiveAddressUse, we can fail here: // - if another application is using this port with exclusive access // - or if the firewall is not properly configured var messagingPort = MessagingPort(); try { _messager = Messager.BindTo(messagingPort); _messager.ReceiveMessage += ReceiveMessage; } catch (SocketException) { // We'll have a chance to try to rebind on next domain reload Debug.LogWarning($"Unable to use UDP port {messagingPort} for VS/Unity messaging. You should check if another process is already bound to this port or if your firewall settings are compatible."); } RunOnShutdown(Shutdown); }); EditorApplication.update += OnUpdate; }
static VisualStudioIntegration() { RunOnceOnUpdate(() => { _messager = Messager.BindTo(MessagingPort()); _messager.ReceiveMessage += ReceiveMessage; RunOnShutdown(Shutdown); }); EditorApplication.update += OnUpdate; }