RepNotify in a custom component not working

RepNotify doesn’t seem to fire on my custom blueprint component in 4.7.2.

I have “component replicates” checked, but OnRep function only executes on server when variable changes.

Hi SentientBot,

I’m attempting to reproduce this bug but not having any luck. Have you checked to make sure both Blueprint and BP Actor Component are both set to replicate?

Hey
Yes i just double checked that replicate is checked on both my character BP and component it uses.
Here are instructions to duplicate.

  • Create a character blueprint and actor component. set both to replicate, character is replicated by default.

  • Assign component to character. Place character on map.

  • Use this code in character

  • have a print string in rep-notify function within actor component
  • I then check use dedicated server and Play. print string in rep-notify function is only run on server.

Using this same setup and clients set to 2, I see a print string from Server and then from both Clients. Does this happen to you in a new project, or only your current project? Was this project converted from 4.6 or an earlier version? I see you have a Cast To node in there, which is no longer necessary. Try deleting that node and pulling off AcTest variable to get its bool variable. I’m not sure it will make a difference, but it’s worth trying.

Strange, i created a new blank project for my test here. I will create a video tonight and see if i can capture problem again.

So here are my project files. set it to 2 players and dedicated server and it will only print on server.

link text

Hi SentientBot,

Thanks for test project! I was able to reproduce issue in 4.7.2 as well as our internal build; it looks like RepNotify function is simply not firing on clients. It doesn’t seem to matter if it’s an actor component or not. I’ve entered a bug report for this issue (UE-11876), and I’ll let you know when I see an update. Thanks again!

I think you should use a normal Actor instead of an ActorComponent. Maybe ActorComponent doesn’t have replicate functionality, i think that it is not designed for that.
You can create your ac starting from Actor class and add it to you character with ChildActor component.

Has this been fixed yet? I am definitely still seeing weirdness with RepNotify not firing. This is kind of extremely important.

Hi malrion,

It has not been fixed internally yet, however it looks like it’s being looked into currently and they’re aiming for a 4.8 fix. I will update this post when I know for certain.

Has this been fixed in 4.8?

Has this issue been fixed yet? Kind of putting me in a choke point as of right now since it kinds of get me stuck.

Hi all,

Yes, this should be fixed in 4.8. If you’re still seeing an issue with it, please link me to a test project that reproduces this behavior so we can investigate further. Thanks!

hi ,

i think i also have this problem in 4.8.2, iam very new to UE so i can also be that i did something wrong in my BP. However here is my testproject
https://.co.nz/#!PJ1CGLoL!B40ENhjFF8waRFXiCkxXOcpD35oUm7k8X4-IBS_EGUM
sorry for large file i tried deleting things but UE keeps bringing them back :confused:

Thanks for project! I see it happening as well, and I’ve reopened our bug report for it (UE-11876). It seems a separate issue with replicated variables in component Blueprints was fixed (UE-14857), but this issue remains. Thanks!

hey ,

thanks for quick response! Is there any workaround for this problem? Because if its impossible to make a simple button in multiplayer iam kinda stuck :confused:

Hi. Your problem is not on repnotify, your blueprint has some errors.
replicated variables must be modified always on server.
Also you are getting ‘accessed none’ errors, than can cause you problems.
I recommed you to see these tutorials to learn how unreal works:

Hi CarlosBC,

In C++, that is certainly true. In Blueprints, however, a variable change on Server OR Client will fire an OnRep function on Server and all Clients. bug in question involves using a Switch Has Authority node before Set, which appears to override this for Client. I just realized this test project does not use that Switch, so this may be a separate bug.

Noedel-Man, it looks like problem may actually be with setting a value of a component not replicating at all. I’m testing this again now, and I’ll let you know what I find.

hey, yes i already watches those tutorials twice… But if a client presses button how do i make that server calls function because multicast nevers works on a client and run on server only works if client owns actor(correct me if iam wrong). But how do i do this when i want to call function form my lightBP? because client does not own actor.

thanks for your help

Thanks Carlos!

It appears I was incorrect about how OnRep is handled in Blueprints, and Carlos has it right: values need to be changed on Server to replicate to Client, even in Blueprint projects. Changes on Client are not replicated to Server.

In Carlos’ sample, he performs RunOnServer event in PlayerBP, which IS owned by Client. Then Server makes variable change, which is replicated to Client. This is how you’d want to handle any communication from Client to Server. There’s some good documentation on ownership here, for reference:

and a bit more in-depth here: