Set replicates for server spawned actor not working

Hey Unrealers

I try to let a client spawn an actor on a listen server.
The listen server sets “set repliactes” of the actors in the spawned actor to true. However, if my client fires the “spawn on server” event it doesn’t work. Server side it works.
What did i do wrong?

Weird, is there a reason why you don’t set these other Actors to replicate by default?
Also how are you spawning these inner actors?

I don’t set them to replicate by default because I wan’t to use the same UnitPlacer for client side showing. As far as i know, I could spawn them directly on the server with replication and OwnerOnlySee. But the owner is the server, so this is not an option. If you have any other ideas how i could handle this please tell me.
I try to achieve a press on a card and then left click inside my world to place them there. But i don’t want other players to see me hovering around. So i deactivate replication, spawn the same on the server, activate replication there and destroy the local actors.

On begin play of the BP_UnitPlacer I spawn them by the given number of units to spawn. The location is calculated in a circle with sin and cos (360°/NumberOfUnits) and a reference of them gets stored inside an array. The server spawns the UnitPlacer so the inner actors should belong to the server, right?
They also get spawned on the server. For example if I spawn 3 units, the number of actors increases by 4 (unit placer and 3 units), decreases by 4 after placing and increases again by 3 (The server side placer spawns the units and destroys himself). So they should be there. After looking into the problem again I found something.
The position of the UnitPlacer gets calculated by the mouse pos, (Screenshot by Lightshot) which comes from the PlayerController. Maybe the position is wrong because server side the index 0 controller is always the listen server controller.

Added a player controller ref. Still same problem. Actors do spawn but they are not visible. The actor positons when i spawn them with the client are 0, 100, 0 or ~-80, ~-50, 0
or 0, ~-50, 0
Server side the postions of the inner actors are comprehensible. So maybe it’s my position function.

Tried to activate replication. They also won’t appear when spawning with replication.

Tried for 2 hours now. Tracked it down. This 2 variables get set locally when the actor gets spawned unreplicated on both server and client. However, only the server sets them
after he spawns them (spawn actor at the execute on server rpc). If the client fires the event both variables result in 0, 0, 0.
I checked the controller ref. It gets set right. Client and server shows controller Controller0 locally. Server on server shows Controller0. Client on server shows Controller1.


Added a branch which checks the bool from “ConvertMouseLocationToWorldSpace”. It fires. So looks like the server can’t read the clients mouse pos.



Found out that i can’t reference the player controller to the server. Also a player pawn ref won’t work. I will open a new thread for this specific problem.
In my head an ExecuteOnServer which updates my mouse pos would work. But this floods my network. How to get a variable on server from the client?

Thanks for your help.