How can I set the specific attribute of the BP on Server?
I'm trying to build a Pick Up Actor System that support multiplayer game. I think I have mistakes about change the attribute's value of a component in BP on server and what I have tried is following: BP_BaseCharacter has a StaticMeshComponent with no static mesh
Pick works well and the problem is Set Static Mesh of "On Projectile Picked"
Set Static Mesh didn't work on Client, and there is a similar situation about Launch a Item.I make both Item and Projectile in BP_ItemProjectile. The BP_ItemProjectile has a boolean RepNotify attribute "Is Projectile".And the ItemProjectile(Projectile Movement Component)'s Auto Activate is off. Now the result is Set Static Mesh( two pic. upper) and Activate Item Projectile( two pic. under) isn't work:
asked Aug 05 '16 at 11:51 AM in Blueprint Scripting
Ok so, first of all, you are setting the Static Mesh only on the Server. This is not replicated by default. To set that, you have two ways:
So it would be ->CastToCharacter->Multicast_SetStaticMesh(StaticMeshToUse) And in the Multicast you directly call "SetStaticMesh" on the Component.
A multicast is called on all instances, so even on the Server.
In BPs, OnRep gets called on every instance. That's a difference to C++, where you need to call it extra for the server. Just so you know for the future.
For he second problem, you might want to remove the extra Server call. You are already "Multicasting" with the onrep. Not need to move all calls back to the server.
Follow this question
Once you sign in you will be able to subscribe for any updates here