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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Is beginplay called on a simulated proxy and when?

This is a noob question , mostly because I'm too lazy to test or might miss some certain exception scenarios in the test.

So when a a players joins a match in progress all the other pawns would generally spawn on this end as a simulated proxy. Now here would BeginPlay would be called on those simulated proxies for the new player?

Or is begin play called only when GameBegins or when an actor is spawned from game logic instead of replication?

I know OnConstruction is called on all role versions of all actors, but does begin play?

Product Version: UE 4.14
Tags:
more ▼

asked Dec 18 '16 at 09:12 PM in Using UE4

avatar image

Commander Shepard
797 62 82 219

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

1 answer: sort voted first

See my detailed answer below. I know I could have left a one liner answer, but I don't want you to spend hours and days figuring out the execution order, execution timing and replication like I did.

ConstructionScript is called on both Authority and non-authority clients when an object is spawned. This executes before BeginPlay which makes it the ideal place to do "bootstrap" / "initialization" that is required before BeginPlay, like set materials, meshes and perform line traces, etc.

BeginPlay is called on Authority and non-authority clients after an object is spawned and placed in the world. This is called after ConstructionScript. If a player joins a game late, their pawn will still have the ConstructionScript method and BeginPlay events fired on both Authority and non-authority clients.

From my own experience: You can rely on ConstructionScript always being called before BeginPlay. But do NOT rely on the Authority BeginPlay to finish it's execution before the non-authority client's BeginPlay. If you set a replicated variable in the Authority's BeginPlay do not rely on that variable being replicated and available for use by the time the non-authority client executes it's BeginPlay. If you need your Authority to set a variable in BeginPlay and replicate that variable to the client so the client can use it in it's own BeginPlay, you should create a custom (Reliable) Run on Owning Client event called "BootstrapClient" and call that event on the Authority's BeginPlay to tell your client it can bootstrap safely.

more ▼

answered Dec 18 '16 at 09:49 PM

avatar image

elitereloaded
694 24 24 55

avatar image Commander Shepard Dec 24 '16 at 04:27 PM

well thanks for your answer but it missed one of the main points and that was about simulated proxy actors.

Say a replication enabled actor exists on server , then a player joins the server later at some point, by this time begin play would already have been called on server when server loaded the map or when server spawned the actor.

So now when a player is joining at considerably later time than server start time would BeginPlay be called again on the replicated version of it on the client? I mean on Non owning clients not just non authorative clients

(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