diff --git a/BoneSync/Sync/Components/SyncableBase.cs b/BoneSync/Sync/Components/SyncableBase.cs index 6bb5145..2636c14 100644 --- a/BoneSync/Sync/Components/SyncableBase.cs +++ b/BoneSync/Sync/Components/SyncableBase.cs @@ -199,6 +199,16 @@ namespace BoneSync.Sync.Components return false; } + + private IEnumerator DespawnSyncable() + { + for (int i = 0; i < 3; i++) + { + gameObject?.SetActive(false); + yield return null; + } + yield break; + } private void _DiscardSyncable(bool force, bool despawn) { @@ -226,10 +236,7 @@ namespace BoneSync.Sync.Components DestroyImmediate(this); // delete the component - if (despawn) - { - gameObject?.SetActive(false); - } + if (despawn) MelonCoroutines.Start(DespawnSyncable()); } private void OnRegister()