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"

[Closed] When is the Actor Role safe to use

Hello,

I'm trying to find a good place to test the role of an actor in C++ as early as possible on a client. Basically I want to know if it is Role_SimulatedProxy or Role_AutonomousProxy. It appears that after PostInitializeComponents or BeginPlay, the role is still undefined. Only after the first tick i can get the correct value. Is there any other function before tick I could use?

Edit: It appears that the Role might not be reliable on the first tick neither. Should we have ReplicatingUsing on Role member variable in Actor class so we can have a callback the first time the Role is set?

Thanks in advance.

Product Version: Not Selected
Tags:
more ▼

asked Jun 05 '15 at 04:00 PM in C++ Programming

avatar image

Answers.Archive STAFF
1.9k 210 316 690

avatar image Answers.Archive STAFF Jun 05 '15 at 04:00 PM

Hi,

We think this post contains useful information which we would like to share with our public UE4 community. With your approval, we would like to make a copy of this post on the public AnswerHub which includes the discussion but strips out your username and company name. Please let us know if you are okay with this.

avatar image Answers.Archive STAFF Jun 05 '15 at 04:00 PM

Absolutely fine.

avatar image Answers.Archive STAFF Jun 05 '15 at 04:00 PM

Thank you!

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

The question has been closed Jun 05 '15 at 04:01 PM by Ben Halliday for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

On the client, you should be able to safely use this after the first PostNetReceive call.

more ▼

answered Jun 05 '15 at 04:00 PM

avatar image

Answers.Archive STAFF
1.9k 210 316 690

avatar image Answers.Archive STAFF Jun 05 '15 at 04:00 PM +

Thanks John. Should BeginPlay and first tick only be called after that then? I might be mistaken but in UE3 i think we could use the Role of an actor on a client as soon as PostBeginPlay was called in script. Otherwise, all replicated actors which require to know their role will need to override that function and cache some kind of flag to know if their role is known. It just feels like it is some necessary overhead.

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

Follow this question

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

Answers to this question