NGO visibility without despawning

Hey,

im currently trying to implement the object visibility feature of netcode into my game to make sure that the client can only see what it should.

The problem im facing now is that the whole object is destroyed when calling OnNetworkHide on the server.

Is it possible to prevent the despawning and just call a custom function where i can for example disable all visuals and when OnNetworkShow is called activate the visuals again?

Thank you for your help

I’m not familiar with the object hiding feature but you could implement this yourself. However you cannot call SetActive on a networked game object as far as I remember, which is probably why the feature will destroy (despawn) such objects.

You could instead set components to be disabled, such as the renderer. If the network object isn’t moving or doing anything else network-wise, it will be inactive as far as networking is concerned (ie it will not generate traffic).

But overall it may be easier to simply redesign your objects so that they are able to be destroyed and recreated.