On the map I have an actor to which I want to change it’s scale. To do that, inside the level blueprint I’m calling an event from “Player Controller”, set as “Run on Server Reliable” which has as input an “Actor”, and inside it for that actor I’m calling “Set Actor Relative Scale 3D”, but the change is only visible on the server and not on clients. I tried to use “Set Actor Transform”, but still the same.
What else do I need to use to change the scale of an actor and to be visible on server and clients as well?
One way you can do it is like this:
In level blueprint where you want to scale the actor, get the Player Controller
(cast it to your controller, in my case it is named MainController
) and call an event from it that tells the server about the effect:
Inside the Player Controller
make the above event to have replicates Run on Server
and check Reliable
, and then in it call an event from the Game Mode
(same as above cast to your Game Mode
, mine is named MainGameMode
) which has access to all the player controllers:
Beside this event that notifies the server, also make another event which will handle the scaling of the actor, only that this time, the event has a different replicates value, set it to Run on owning Client
and also check Reliable
.
Now inside the Game Mode
I have an array named Player Controllers
which contains all the Player Controller
(I added a function inside Begin Play
from MainController
which adds the new controller in the array, which helps me get the controllers faster when needed). Now inside the event create a loop for the controllers and for each of them call the function which will set the scale of the actor.
Now fell free to modify the events to suit your needs, maybe you want to send the scale as well beside the actor, or do something else also, up to you.
2 Likes
Thank you! This is working!