Skip to content

Commit 7916bcf

Browse files
authored
Add files via upload
1 parent 222f3f1 commit 7916bcf

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

BubbleTransport/BubbleTransport.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public class BubbleTransport : Mirror.Transport
1414
{
1515
public static BubbleTransport instance;
16+
static bool instanceCreated = false;
1617

1718
#region DllImports
1819
[DllImport("__Internal")]
@@ -78,7 +79,7 @@ public class InviteRecievedEvent : UnityEvent { }
7879

7980
bool connected = false;
8081

81-
bool needToDisconnect = false;
82+
bool needToDisconnectFlag = false;
8283

8384
/* Structure of the transport
8485
@@ -175,8 +176,6 @@ static void OnInviteRecieved()
175176
}
176177
instance.inviteRecieved?.Invoke();
177178

178-
print(SceneManager.GetActiveScene().path);
179-
180179
//Numbers do not matter, it instantiates from an invite
181180
_FindMatch(0, 0);
182181
}
@@ -216,7 +215,7 @@ public override Uri ServerUri()
216215
[AOT.MonoPInvokeCallback(typeof(OnClientDisconnectedDelegate))]
217216
static void ClientDisconnectedCallback()
218217
{
219-
instance.needToDisconnect = true;
218+
instance.needToDisconnectFlag = true;
220219
}
221220

222221
delegate void OnClientDidDataRecievedDelegate(IntPtr data, int offset, int count);
@@ -346,21 +345,21 @@ public override void ServerStop()
346345

347346
#endregion
348347

349-
private void LateUpdate()
348+
public override void ClientLateUpdate()
350349
{
351-
//IK it is pretty messy but ah well
352-
if(needToDisconnect)
350+
if(needToDisconnectFlag)
353351
{
354352
OnClientDisconnected?.Invoke();
355-
needToDisconnect = false;
353+
needToDisconnectFlag = false;
356354
}
357355
}
358356
private void Awake()
359357
{
360-
if (instance == null)
358+
if (!instanceCreated)
359+
{
361360
instance = this;
362-
else
363-
Destroy(this.gameObject);
361+
instanceCreated = true;
362+
}
364363

365364
try
366365
{

0 commit comments

Comments
 (0)