mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Initialize transport in network manager (#48)
This commit is contained in:
parent
1e61aaa05a
commit
38a4ca27f4
@ -96,6 +96,7 @@ void Awake()
|
||||
{
|
||||
Debug.Log("Thank you for using Mirror! https://forum.unity.com/threads/unet-hlapi-community-edition.425437/");
|
||||
InitializeSingleton();
|
||||
InitializeTransport();
|
||||
}
|
||||
|
||||
void InitializeSingleton()
|
||||
@ -140,6 +141,13 @@ void InitializeSingleton()
|
||||
}
|
||||
}
|
||||
|
||||
// Initializes the transport, by default it is Telepathy
|
||||
// override method if you want to use a different transport
|
||||
public virtual void InitializeTransport()
|
||||
{
|
||||
Transport.layer = new TelepathyWebsocketsMultiplexTransport();
|
||||
}
|
||||
|
||||
// NetworkIdentity.UNetStaticUpdate is called from UnityEngine while LLAPI network is active.
|
||||
// if we want TCP then we need to call it manually. probably best from NetworkManager, although this means
|
||||
// that we can't use NetworkServer/NetworkClient without a NetworkManager invoking Update anymore.
|
||||
|
@ -9,8 +9,10 @@ public static class Transport
|
||||
// hlapi needs to know max packet size to show warnings
|
||||
public static int MaxPacketSize = ushort.MaxValue;
|
||||
|
||||
// selected transport layer: Telepathy by default
|
||||
public static TransportLayer layer = new TelepathyWebsocketsMultiplexTransport();
|
||||
// selected transport layer
|
||||
// the transport is normally initialized in NetworkManager InitializeTransport
|
||||
// initialize it yourself if you are not using NetworkManager
|
||||
public static TransportLayer layer;
|
||||
}
|
||||
|
||||
// abstract transport layer class //////////////////////////////////////////
|
||||
|
@ -31,6 +31,7 @@ public void TestWritingLargeMessage()
|
||||
[Test]
|
||||
public void TestWritingHugeArray()
|
||||
{
|
||||
Transport.MaxPacketSize = 1000000;
|
||||
// try serializing array > 64KB and see what happens
|
||||
NetworkWriter writer = new NetworkWriter();
|
||||
writer.WriteBytesAndSize(new byte[100000]);
|
||||
|
Loading…
Reference in New Issue
Block a user