Wrong scale with 1,1,1 on client side

Repro:

  • Create an Actor BP
  • Set the default actor scale to something under 1,1,1
  • Enable replication
  • Spawn the actor with SpawnActor on server side with scale 1,1,1

Result:
The actor is spawned on the server and client side, but only the server have the correct scale of 1,1,1 and the client have the default scale.

Project: [link][1] Press P for spawning the actor and L for printing the scale

Hey Doktor.,

This is happening because you need to make sure that the server itself is spawning the cube.

Here is a screenshot of an example:

The ServerSpawnCube event is set to “Run on Server” and is “Reliable”. This means that when the client presses the “T” key, the ServerSpawnCube function the client “asks” the server to run the function. Because the server is what spawns the SpawnActor Bluperint, which is set to replicated, all the clients are going to get a copy of it so it is simulated between the clients and the server. This means that when the “Make Transform” node sets the scale to X3.0f, Y3.0f, Z3.0f, all clients will see that as well.

This results in:

A side note:

To begin, the Scale set from the Transform being passed into the “Spawn Actor From Class” Blueprint node is always going to override the scale of both the Actor and the of the Actor. The children from this point will keep their relative scale based on the scale of the actor.

With that in mind, if you set the default component to something like “ChildActor” and if you set the default Static Mesh Component as it child and then scale it to X0.25, Y0.25, Z0.25 and spawn the Actor with a scale of X1.0, Y1.0, Z1.0, the relative scale of the Static Mesh Component is still X1.0, Y1.0, Z1.0 meaning it keeps the default scale of X0.25, Y0.25, Z0.25.

Let’s say hypothetically you scale the Actor using the “Spawn Actor From Class” Blueprint node to X3.0, Y3.0, Z3.0. This means the Static Mesh Component with a default scale of X0.25, Y0.25, Z0.25 is going to scale 3x, or to X0.75, Y0.75, Z0.75 while the Actor and will be a scale of X3.0, Y3.0, Z3.0.

In the example project i’m spawning the actor from the server itself and it’ll appear on both server and client, but the client don’t have the correct scale. The Actor scale is different on server and client, when i’m using another scale under 1,1,1 the scale will be correct on server and client and this is only happen when i’m changing the scale of the under 1,1,1 inside of the bp

I just made a short video: [YouTube Video][1]

[1]: