BUG? Spawned Actors don't replicate blueprints correctly
Hey, I recently encountered a bug with spawning replicated actors. So what I have is the blueprint below. A blank actor spawns a random trap from an array at begin play which is replicated to any clients, such that everyone sees that this trap is spawned. This works perfectly for when the actor is placed directly into the scene, but when spawned into the scene, the replication isn't synchronized. Any clue why this happens?
This is a screenshot of the blueprint inside my random trap actor. As you can see, it picks a class from an array variable inside the blueprint, in this example, a cylinder or a cone blueprint class. All three blueprints, the random trap class, the cylinder class, and the cone class all have the "Replicates" box ticked.
Here's a photo of the traps being run in the editor. The bottom two are Random Traps placed directly into the scene, and as you can see, are replicated to the client correctly. The upper one is spawned into the scene through the Level blueprint's "Begin Play" node. In the upper one, the server only sees one trap, but the client sees both, which I assume is because it spawned a random trap while it also replicated the server's trap.
asked Nov 23 '15 at 10:20 PM in Bug Reports
Since the RandomTrap blueprint exists both on the Server and the Client, this is being run twice on the Server. First, the Server instance of the BP runs and spawns a random trap. Then the Client instance asks the Server to do the same, at the same position. That also explains why you see two different classes spawned: each time the Event is run, it's getting a random value for RandIndex.
You probably want to do this without the Run on Server replication, and only fire the event on the Server. You can specify this by using the Switch Has Authority node before calling the Event:
Hope that helps! Let me know if you have further questions.
answered Nov 24 '15 at 09:02 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here