online fix

This commit is contained in:
2025-10-27 14:34:26 +01:00
parent 3c5507dd87
commit cf44edc19a
4 changed files with 80 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ using Game.Scripts.Runtime.Abstractions;
using Game.Scripts.Runtime.Data;
using UnityEngine;
using Unity.Netcode;
using MegaKoop.Game.Networking;
namespace Game.Scripts.Runtime.Pooling
{
@@ -144,6 +145,8 @@ namespace Game.Scripts.Runtime.Pooling
{
Destroy(netObj);
}
var identity = instance.GetComponent<NetworkIdentity>();
identity?.ClearNetworkId();
bucket.Available.Enqueue(instance);
item.Handle?.NotifyDespawned();
InstanceDespawned?.Invoke(instance, item.Definition);
@@ -183,6 +186,9 @@ namespace Game.Scripts.Runtime.Pooling
go.name = $"{definition.Prefab.name}_Pooled";
go.SetActive(false);
var identity = go.GetComponent<NetworkIdentity>();
identity?.ClearNetworkId();
var handle = go.GetComponent<PooledInstance>();
if (handle == null)
{