Spawn and attach Actor to client

Hello everybody,
I’m trying to create a VR multiplayer game.
It is important that every player has a head attached and also two hands as MotionController.
So far I have tried that as soon as the playable Pawn is selected from the menu the event BeginPlay from the selected Pawn is triggered.
After that the event SpawnHead (Replication, Run on Server) is called. This event spawns the blueprint of the head at 0,0,0. Then the event AttachHead is called.
This event is a multicast and uses attach actor to attach the head to the pawn. On the server, this works fine, but not with the client. The server sees itself correctly, however the head of the client still stays in position 0,0,0 (and not attached to the Pawn).
The client, however, sees the head attached to the server and moving correctly.

I hope somebody can help me this time. I am starting to despair.
Incidentally, the same applies to the MotionController. Maybe someone can upload a suitable setup as an example as screenshot.
would be very grateful.

Hey, you will have to multicast from the server to the clients, so the clients also do know what is up.

Thanks for the quick reply. But I don’t know exactly what you mean. I post some screenshots and maybe you can tell me what i did wrong? It’s all inside the MotionController Pawn except for the last which is located in the CharacterSelectWidget…

My question is why do you attach thoes components with code, and not simply add them to your character.

Like Caboose say I found that add anything you need to the character and change the visibility is the best solution, i think is better to use blueprint mode for attach real environment stuff to the character, like pickups.

If I do so and the client tires to join the match unreal crashes with error: Assertion failed: Component != nullptr [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\HeadMountedDisplay\Private\LateUpdateManager.cpp] [Line: 75]

Anyway I will reply to your question, you are spawning an actor on server side and attaching it to clients using a multicast event, the problem is: that actor exist actually only on the server and was never spawned on clients, so you’re attaching (nothing) something that from client side doesn’t exist.

Thank you very much. But I think that your first purpose sounds much better.
I tried to attach hands and head bp’s to my character. But I dont know if this is the right way?

I never worked with VR, in a normal environment I will attach it to the character skeletal mesh, but for VR I think is different so try it like you’re doing and let us know.

I think the game crashes cuz of “wrong” attachments in character. When I remove them it runs like before…

if the attachments are wrong it crash.

If somebody ever has worked with attach MotionControllers in VR or similar to that it would be very glad to hear from you

I added vr support to my project recently and all I did was adding the motion controller component to my character, my project also supports multiplayer but I was not able to test vr + multiplayer since.

Can you please tell me how you add MotionController to your character?

What engine version are you using?

Thanks man. This is a nice workaround.
Now the server can see the client and his actions and vice versa. But unfortunately I am now facing the next, similar problem.
If the client tries to pick up (grab) the VRPickup Cube the server don’t recognize its movement and change of position.
If the server grabs and place that cube it is automatically updating to clients…
I tried to solve the problem by my own but it don’t work.


In motion controller pawn: When a player hit the Trigger of one of the motion controllers the Event in Pawn will trigger.

TriggerPressed → Switch has Authority → [REMOTE] → (RunOnServer)ClientTriggerPressed → “Standard VR Grab functionality” will start…

*TriggerPressed → Switch has Authority *-> [AUTHORITY] → (Multicast)ServerTriggerPressed → “Standard VR Grab functionality” will start…

The PickUpCube is set on replicate, replicate movement and run on client.
Also in Component tab “Component replicate”.

I don’t know why the server can’t see the changes of the client… :(:(:frowning:

I hop you can help me.