mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix(MultiplexTransport): OnValidate check that SimpleWebTransport is last
- Warns user if SimpleWebTransport isn't last - Prevents confusion caused by transports being out of order
This commit is contained in:
parent
35d9d65157
commit
f863b27a86
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -42,6 +43,14 @@ public class MultiplexTransport : Transport
|
|||||||
// next multiplexed id counter. start at 1 because 0 is reserved for host.
|
// next multiplexed id counter. start at 1 because 0 is reserved for host.
|
||||||
int nextMultiplexedId = 1;
|
int nextMultiplexedId = 1;
|
||||||
|
|
||||||
|
void OnValidate()
|
||||||
|
{
|
||||||
|
// Warn user if SimpleWebTransport is not the last transport in the
|
||||||
|
// list to prevent confusion from having transports out of order.
|
||||||
|
if (transports.Length > 1 && transports.Any(transport => transport is SimpleWeb.SimpleWebTransport) && transports.Last() is not SimpleWeb.SimpleWebTransport)
|
||||||
|
Debug.LogFormat(LogType.Warning, LogOption.NoStacktrace, gameObject, "MultiplexTransport: SimpleWebTransport should be the last transport in the list.");
|
||||||
|
}
|
||||||
|
|
||||||
// add to bidirection lookup. returns the multiplexed connectionId.
|
// add to bidirection lookup. returns the multiplexed connectionId.
|
||||||
public int AddToLookup(int originalConnectionId, int transportIndex)
|
public int AddToLookup(int originalConnectionId, int transportIndex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user