Download

Elegant method to implement "CleanUp" function over a network

I have a NetMulticast function for doing cleanup (Removing Particle Effects etc) so I destroy the actor somthing like this



void CustomDestroy()
{
   MutlticastCleanup();
   Destroy();
}

The issue is that because the actor is destroyed the multicast function doesn’t get called on any of the clients (commenting out the destroy function and it works). I thought about calling Destroy() on a timer after some arbitrary “enough” time for the multicast function to get called but this feels very inelegant and hacky.

Any suggestions?

If the Actor is Replicated and you call Destroy on the server it will also call Destroy on the Client eventually so you don’t really need any Multicast. Cleanup is exactly what the Destroy Event is for, it should never call any latent functions on the Actor that is being destroyed.

Thank you I will look into finding the Destroy Event.

Sorry please could you explain what you mean by latent functions. Cheers.

A function that isn’t called in the same frame (tick)