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"

Any predetermined execution order for the begin play events of default classes?

Hi, is there any general predetermined order in which the 'Begin Play' events occur for the default classes like the Game Mode, HUD, Default Pawn, Player Controller, Game State, Level Blueprint and Player State?

Product Version: Not Selected
more ▼

asked May 11 '15 at 11:25 AM in Blueprint Scripting

avatar image

1k 83 75 118

avatar image gamescodedogs Jan 22 '16 at 05:03 PM

Found the brilliant!

  • Editor: BeginPlay: Controller, Pawn, Mode, State, Actors[] ...

  • Build (win64): BeginPlay: Actors[], State, Mode, Pawn, Controller ...

Have no idea why :)

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

4 answers: sort voted first

As far as I know they are instant and triggered at the same time, when the level is completely loaded.

I would like a confirm from a more experienced person too. But so far I got many BeingPlay events that are connected to each other on my own game and they are not having any problems. For example my Gamemode does something to my player right away, while my player is giving info back to my gamemode at the same time with both beginplay events. I would have an error if there was an order.

One thing I am not sure is that, if there is an order and it is not obvious when the game is small. For now my game launches in 1 second so maybe I am wrong.

Best way you can check I think is, make Being Play event on all those classes, and connect Print Strings upon them with -different- colors. If the color is randomised everything you launch the game, there is no order. If they are always the same pattern, there is. ^^

more ▼

answered May 11 '15 at 01:14 PM

avatar image

782 38 34 70

avatar image Stormrage256 May 11 '15 at 01:55 PM

Thanks for your answer, Achilleon. I have not experienced any problems at my end either. But since we have a multitude of systems and platforms on which games are supposed to run, I would just like to confirm it. I had thought of using the debugging to find a pattern if I did not get a answer here. But if Epic really has added some sort of order, it would be nice to know about that.

avatar image Narghile May 11 '15 at 02:01 PM

I am with Achilleon, they should all function at same time, aligning everything.


avatar image Stormrage256 May 11 '15 at 04:41 PM

I've tested it in the First Person template using break points at Event Begin Play call. This seems to be the order in which they are executed:

Player Controller >> Default Pawn >> HUD >> Game Mode >> Game State >> Player State >> Level Blueprint

avatar image rz1974 Aug 21 '15 at 06:40 AM

Nice information I just need!

avatar image Marcosp Sep 15 '15 at 08:10 AM

There are issues to it. Like for example I had a call on character::BeginPlay

 //AddControllerPitchInput(-90.0f);//make it top down    

That wouldn't work, because the player controller was not fully initialized yet.

avatar image Stormrage256 Sep 15 '15 at 11:44 AM

I'm not using the Begin Play events on all of these blueprints. I just use it on one of them and initialize the rest through custom events.

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

I am suuuper late to this question. But one of the things I did is, in my custom character I check if my dependency actor has already been initialized and if it has not then I initialize it. For example, I want AWorldSet actor to have its BeginPlay executed before APSCCharacter is done with its begin play. So I do this APSCCharacter's BeginPlay

 void APSCCharacter::BeginPlay()
    AActor* worldSet;
    // Iterate through UWorld to find the object, worldSet
     if (!worldSet->HasActorBegunPlay())
   // Do dependent logic here.

Note this only calls BeginPlay for world set once. So you don't have to worry about being play being called twice. Once this execution is complete world set's HasActorBegunPlay() will return true preventing further execution of BeginPlay in the same frame.

Hope that helped!

more ▼

answered Jul 25 '17 at 05:20 AM

avatar image

302 13 13 25

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

Or have a single level script that gets Ticks, and count a few ticks, then execute functions in all the desired blueprints in some order.

more ▼

answered May 11 '15 at 03:24 PM

avatar image

SND R Keene
968 31 120 113

avatar image Stormrage256 May 11 '15 at 04:54 PM

Yea that makes sense from a code flow viewpoint. I will try it out.

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

Why not make the order yourself?

There are many ways to do it. The most simplistic way is, adding delays to each Begin Plays of each BPs.

No Delay = First one to trigger in Game Mode 0.01 Delay = Do something in player BP 0.02 Delay = Do something in player Controller

So it will be guaranteed to happen in order. Surely there are more proffesional ways, but that would be a start I guess. I did that before putting everything into right order so they would work without delays. =)

more ▼

answered May 11 '15 at 02:54 PM

avatar image

782 38 34 70

avatar image Stormrage256 May 11 '15 at 04:46 PM

Thanks, I've been keeping delay as a last resort to be used after extensive testing on my old iPad mini. I do not trust the older mobile/tablet devices. :P

(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