Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ public bool UseWebSockets
set => m_UseWebSockets = value;
}

[Tooltip("Per default the client/server will communicate over UDP. Set to true to communicate locally using IPC.")]
[SerializeField]
private bool m_UseIPC = false;

public bool UseIPC
{
get => m_UseIPC;
set => m_UseIPC = value;
}

/// <summary>
/// Per default the client/server communication will not be encrypted. Select true to enable DTLS for UDP and TLS for Websocket.
/// </summary>
Expand Down Expand Up @@ -1576,9 +1586,9 @@ public void CreateDriver(UnityTransport transport, out NetworkDriver driver,
heartbeatTimeoutMS: transport.m_HeartbeatTimeoutMS);

#if UNITY_WEBGL && !UNITY_EDITOR
if (NetworkManager.IsServer && m_ProtocolType != ProtocolType.RelayUnityTransport)
if (NetworkManager.IsServer && m_ProtocolType != ProtocolType.RelayUnityTransport && m_UseIPC == false)
{
throw new Exception("WebGL as a server is not supported by Unity Transport, outside the Editor.");
throw new Exception("WebGL as a server is not supported by Unity Transport, outside the Editor. Use IPC or Relay instead.");
}
#endif

Expand Down Expand Up @@ -1642,7 +1652,11 @@ public void CreateDriver(UnityTransport transport, out NetworkDriver driver,
#endif

#if UTP_TRANSPORT_2_0_ABOVE
if (m_UseWebSockets)
if (m_UseIPC)
{
driver = NetworkDriver.Create(new IPCNetworkInterface(), m_NetworkSettings);
}
else if (m_UseWebSockets)
{
driver = NetworkDriver.Create(new WebSocketNetworkInterface(), m_NetworkSettings);
}
Expand Down