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 for offline single-player games?

Hello,

Is it okay to set the variable to RepNotify (in 100% single-player game) and then use its OnRep_[Variable name] Function for cases where i would want to handle some logic every time the value of that variable changes?

Product Version: UE 4.18
Tags:
more ▼

asked Dec 20 '17 at 09:22 PM in Blueprint Scripting

avatar image

Poster.hr
8 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hey there, but why dont you use a setter function instead? Every time you want to change the value of variable X you do a SetX() that sets the value and does additional logic.

more ▼

answered Dec 20 '17 at 09:28 PM

avatar image

xlar8or
6k 162 129 305

avatar image Poster.hr Dec 20 '17 at 09:37 PM

I dont know, it seems more convenient for me, for example if i have some variable that gets changed a lot from a few different places and every time it does i want to do the same thing, its easier for me to just change the variable and let the repnotify function handle the rest.

avatar image xlar8or Dec 20 '17 at 09:48 PM

The only difference is that everytime you change the variable instead of doing X = 2; you do SetX(2); (from the same class or from others, as long as you set the function to public) and it runs whatever update code you want in the set, so it's kind of the same thing but more lightweight than repnotifies, but it's up to you, if it works and it's more convenient for you then use it, the overhead shouldnt be very noticeable.

avatar image Poster.hr Dec 20 '17 at 10:29 PM

Thanks, i believe you answered my question.

avatar image xlar8or Dec 20 '17 at 10:33 PM

Good to know :) Please mark the answer as correct to close it :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

In addition, RepNotify variables add 4 bytes of RAM per object, for networking logics.
Keep that in mind.

more ▼

answered Mar 04 '18 at 04:31 PM

avatar image

Arty-McLabin
925 20 44 64

avatar image Poster.hr Mar 05 '18 at 09:48 AM

Thanks for the info, i'll keep that in mind.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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