Download

Spawn actor problem on multiplayer game

Hi there
I’m really bewildered with spawning actors in multiplayer games. Let me describe the procedure that I followed here:

1- I created an actor named **Ground **and it has a editable and expose on spawn variable named **Width **which define the width of Ground (a simple box).
2- **Ground **is a replicated actor.
3- I created another actor named **GroundGenerator **and in this actor if it **HasAuthority **I spawned the Ground actor with a random **Width **value on BeginPlay.
4- I put GroundGenerator on an empty level.
5- Played the game in server and one client. In server there is a **Ground **with random **Width **but in client there is a **Ground **with default Width.

So can anyone please tell me what am I doing wrong here? I tried different scenarios here like replicating the **Width **and many other things. The only method that helped me fix the problem was using RepNotify on **width **and reconstructing the actor. But it’s not good for a more complicated actor. In complex situations I should reconstruct my **Ground **with every variable that I used in spawning.

Thanks