Replication of an entity spawned by the client

 Author: Jairo Manon

We've been having this confusing replication problem where the client tries to spawn a preview mesh of a spawner which spawns the little minions.  When trying to actually spawn the entity it would only replicate through the server even though the logic that spawns this actor is done through an RPC (Replication Procedure Call).  However, even through this, it wasn't enough for it to be replicated.  



Through many tests, I've found that the core of the problem wasn't in the actual way that it's replicating or from the actor itself, it comes from where this actor is coming from.  So as it turns out, the widget that is spawning this preview mesh was the culprit for it to not replicate.  The reason being was that networking and widgets don't really miss up together that will.  I'm not sure of the details beyond that, but it has to do with the fact that in unreal, the widget is being destroyed and remade several times.  So when we spawn the actor from the widgets, it wouldn't exactly work with the replication that needs to happen.

To fix this problem, I had to just take this code that is spawning the actor to another class, and basically just make a delegate.  So I've changed this logic to actually happen through the actual player controller that owns this widget.  Once I've done that, the actor started to replicate and the entity that spawned from it started to follow the path to their destination.

Comments

Popular Posts