mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 18:32:45 +00:00
check _cts before building/removing world objects
This commit is contained in:
parent
8a67003196
commit
d706ffd998
@ -33,6 +33,11 @@ namespace QSB.WorldSync
|
||||
|
||||
public static async UniTaskVoid BuildWorldObjects(OWScene scene)
|
||||
{
|
||||
if (_cts != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_cts = new CancellationTokenSource();
|
||||
|
||||
if (!PlayerTransformSync.LocalInstance)
|
||||
@ -79,13 +84,20 @@ namespace QSB.WorldSync
|
||||
|
||||
public static void RemoveWorldObjects()
|
||||
{
|
||||
_cts?.Cancel();
|
||||
_cts?.Dispose();
|
||||
_managerTasks.Clear();
|
||||
_objectTasks.Clear();
|
||||
if (_cts == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_cts.Cancel();
|
||||
_cts.Dispose();
|
||||
_cts = null;
|
||||
|
||||
GameReset();
|
||||
|
||||
_managerTasks.Clear();
|
||||
_objectTasks.Clear();
|
||||
|
||||
foreach (var item in WorldObjects)
|
||||
{
|
||||
item.Try("removing", item.OnRemoval);
|
||||
|
Loading…
x
Reference in New Issue
Block a user