#its not getting despawned for me right
1 messages · Page 1 of 1 (latest)
private void KnifeSpawnServerRpc()
{
spawnedknifeTransform = Instantiate(spawnedknifeprefab);
spawnedknifeTransform.GetComponent<NetworkObject>().Spawn(true);
}```
this is knife spawn code which is working well and its attached to player prefab and its spawning once as it should even if multiple player joins the game
but the issue arises with despawn code, when the game host calls it then it gets despawned but when any of the clients call it then it wont get despawned, heres the code below
public void KnifeDespawnServerRpc()
{
spawnedknifeTransform.GetComponent<NetworkObject>().Despawn(true);
}```
the issue it that clients are unable to despawn the knife
@hollow zinc
Are you getting errors on the host? If this code is on the player object then you shouldn't have to worry about ownership.
no its despawning as it should on host
but its not despawning if the client player tries to despawn
@hollow zinc
I mean when the client calls the RPC, are you seeing any errors on the host
no there are no errors
Is the RPC getting called at all on the client?
im not sure