|
13 | 13 | public class BubbleTransport : Mirror.Transport |
14 | 14 | { |
15 | 15 | public static BubbleTransport instance; |
| 16 | + static bool instanceCreated = false; |
16 | 17 |
|
17 | 18 | #region DllImports |
18 | 19 | [DllImport("__Internal")] |
@@ -78,7 +79,7 @@ public class InviteRecievedEvent : UnityEvent { } |
78 | 79 |
|
79 | 80 | bool connected = false; |
80 | 81 |
|
81 | | - bool needToDisconnect = false; |
| 82 | + bool needToDisconnectFlag = false; |
82 | 83 |
|
83 | 84 | /* Structure of the transport |
84 | 85 | |
@@ -175,8 +176,6 @@ static void OnInviteRecieved() |
175 | 176 | } |
176 | 177 | instance.inviteRecieved?.Invoke(); |
177 | 178 |
|
178 | | - print(SceneManager.GetActiveScene().path); |
179 | | - |
180 | 179 | //Numbers do not matter, it instantiates from an invite |
181 | 180 | _FindMatch(0, 0); |
182 | 181 | } |
@@ -216,7 +215,7 @@ public override Uri ServerUri() |
216 | 215 | [AOT.MonoPInvokeCallback(typeof(OnClientDisconnectedDelegate))] |
217 | 216 | static void ClientDisconnectedCallback() |
218 | 217 | { |
219 | | - instance.needToDisconnect = true; |
| 218 | + instance.needToDisconnectFlag = true; |
220 | 219 | } |
221 | 220 |
|
222 | 221 | delegate void OnClientDidDataRecievedDelegate(IntPtr data, int offset, int count); |
@@ -346,21 +345,21 @@ public override void ServerStop() |
346 | 345 |
|
347 | 346 | #endregion |
348 | 347 |
|
349 | | - private void LateUpdate() |
| 348 | + public override void ClientLateUpdate() |
350 | 349 | { |
351 | | - //IK it is pretty messy but ah well |
352 | | - if(needToDisconnect) |
| 350 | + if(needToDisconnectFlag) |
353 | 351 | { |
354 | 352 | OnClientDisconnected?.Invoke(); |
355 | | - needToDisconnect = false; |
| 353 | + needToDisconnectFlag = false; |
356 | 354 | } |
357 | 355 | } |
358 | 356 | private void Awake() |
359 | 357 | { |
360 | | - if (instance == null) |
| 358 | + if (!instanceCreated) |
| 359 | + { |
361 | 360 | instance = this; |
362 | | - else |
363 | | - Destroy(this.gameObject); |
| 361 | + instanceCreated = true; |
| 362 | + } |
364 | 363 |
|
365 | 364 | try |
366 | 365 | { |
|
0 commit comments