x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 the OnRep function only executes on the server when the variable changes.

Product Version: Not Selected
Tags:
more ▼

asked Mar 10 '15 at 12:06 AM in Bug Reports

avatar image

SentientBot
6 1 2 5

avatar image Ben Halliday STAFF Mar 10 '15 at 11:34 PM

Hi SentientBot,

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

avatar image SentientBot Mar 11 '15 at 01:58 AM

Hey Ben Yes i just double checked that replicate is checked on both my character BP and the 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 the component to the character. Place character on map.

  • Use this code in the character

alt text

  • have a print string in the rep-notify function within the actor component

  • I then check use dedicated server and Play. The print string in the rep-notify function is only run on the server.

bugcharacterbp.jpg (150.2 kB)
avatar image Ben Halliday STAFF Mar 11 '15 at 05:35 PM

Using this same setup and clients set to 2, I see a print string from the 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 the AcTest variable to get its bool variable. I'm not sure it will make a difference, but it's worth trying.

avatar image SentientBot Mar 11 '15 at 06:33 PM

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

avatar image SentientBot Mar 11 '15 at 10:02 PM

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

link text

bugtest.zip (365.3 kB)
avatar image CarlosBC Mar 17 '15 at 01:31 AM

I think you should use a normal Actor instead of an ActorComponent. Maybe the ActorComponent doesn't have the 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.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi SentientBot,

Thanks for the test project! I was able to reproduce the issue in 4.7.2 as well as our internal build; it looks like the 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!

more ▼

answered Mar 15 '15 at 07:45 PM

avatar image malrion Apr 13 '15 at 03:49 AM

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

avatar image Ben Halliday STAFF Apr 13 '15 at 04:22 PM

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.

avatar image Janyx Jul 11 '15 at 02:54 AM

Has this been fixed in 4.8?

avatar image DoctorIcy Jul 11 '15 at 05:07 PM

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.

avatar image Ben Halliday STAFF Jul 13 '15 at 07:04 PM

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!

avatar image Noedel-Man Jul 22 '15 at 04:12 PM

hi Ben,

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://mega.co.nz/#!PJ1CGLoL!B40ENhjFF8waRFXiCkxXOcpD35oUm7k8X4-IBS_EGUM sorry for the large file i tried deleting things but UE keeps bringing them back :/

avatar image Ben Halliday STAFF Jul 22 '15 at 05:47 PM

Thanks for the 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!

avatar image Noedel-Man Jul 22 '15 at 06:01 PM

hey Ben,

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

avatar image CarlosBC Jul 22 '15 at 07:44 PM

Hi. Your problem is not on repnotify, your blueprint has some errors. The replicated variables must be modified always on the 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: https://www.unrealengine.com/blog/blueprint-networking-tutorials

avatar image Ben Halliday STAFF Jul 22 '15 at 08:24 PM

Hi CarlosBC,

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

Noedel-Man, it looks like the 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.

avatar image Noedel-Man Jul 22 '15 at 08:26 PM

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

thanks for your help

avatar image CarlosBC Jul 22 '15 at 10:09 PM
avatar image Ben Halliday STAFF Jul 22 '15 at 10:20 PM

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 the Server to replicate to the Client, even in Blueprint projects. Changes on the Client are not replicated to the Server.

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

https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Blueprints/index.html

and a bit more in-depth here:

https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Actors/OwningConnections/index.html

avatar image Noedel-Man Jul 23 '15 at 12:07 AM

"It appears I was incorrect about how OnRep is handled in Blueprints" do you mean by that that calling onRep on an random actor does work when you type it in c++?

avatar image Noedel-Man Jul 23 '15 at 12:06 AM

wow thank you carlosBC, I cant say that i understand the BP but iam going to study it :p. But does this method also works when you have more things to do with the 'use' button like opening doors and such because then your playerBP will be filled with all these little bits of "code". Or is it just the way it goes? Again thank you for your help!

avatar image CarlosBC Jul 23 '15 at 11:23 AM

In my code, when the character collides with the lamp, the character saves that actor reference. If the character collides with more than one actor, it will only keep the reference of the last, so it will only interact with the last. You can use this system to interact with any other actor, for example, to make a door you only need to change the "On Rep Lichtann" to do your door action. But you can use other system, for example, when the player press "Use", you check with a sphere collision what actors are colliding, and interact only with the closest.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question