I am spawning a replicated actor, then calling an event on a client with the new actor as a parameter.
The “pick up” Event calls another event that is replicated to owning client.
My problem is that the newly spawned object is still invalid when the event call is executed on the client… I can attempt to retry the event after some arbitrary amount of time, but the passed object will always be invalid.
If I instead put a small delay in here everything works as expected.:
Is this behavior expected or is this a bug? Is there a better way to accomplish what I am doing?
If you do it like this you have to wait until the client knows about this Actor, so until it is replicated and valid for the Client. This can take a few ticks.
The odd part to me is that if the object is not valid when the client receives the event call, it will never become valid. I was hoping the client alone could handle waiting for the object to become valid, rather than the server waiting and hoping the object is replicated to the client after x amount of time.
Use ServerEvent => MultiCastEvent to spawn your Actor. So everybody has his own one instantly
User the Server to tell the Client about the spawned Actor => Set the Reference
Check the valid status of the spawned Actor until it is valid and only then execute the ClientEvent
Can you share a project or an example? Or describe what you spawn and where? E.g. do you spawn it in your character? How does the pickup event look like etc