Here are the details: if I load the level (let call it Cave) in the editor and click play, BeginPlay event of the actor is properly fired.
But if I load the menu level first, and then click the play button, which subsequently load level ‘Cave’, the event is not fired.
I am stumped, I have searched in a lot of links but I still cannot find the answer. Menu load level ‘Cave’ using blueprint function ‘Open Level’ as below:-
You should probably update if possible for starters.
But I’ve never experienced a situation where Begin Play did not fire, so the problem is likely in your code. You haven’t really shown us much to go off from so perhaps if you could include a few more screen captures we may be able to help.
Sorry for not responding earlier - I just need something conclusive to say here.
Indeed it is the level which causes for not just BeginPlay to fire, but all events are not firing at all.
I really need to know the reasons; otherwise it is going to be troublesome when complicated levels suddenly, are not firing events at all. Anyone faced the same problem before?
The level at fault is simple, it is just a test-bed level which has plane in it (it is an empty level).
It is really silly… i made a backup of all levels and put them all into a folder named backup, under ‘Content’ folder. So the menu detect there are two maps (I didn’t specify full path), but then UE4 decides to resolve it to the one in backup which has no actor in it…
Instead of making backup files, you really need to use a version control system, git, perforce etc. You are asking for a headache tyring to back individual files up and keep track. Anything that you put under the content folder will get loaded by the Editor, so if you are backing up files keep them separate from your project folders.
Check the Name of the level that you are passing into the OpenLevel Node and make sure it is exactly the same. BreakPoints don’t always hit when debugging, sometimes it depends on where you press the play in editor button, but print statements will always work so you can put a print string like Zuestiak said before the OpenLevel node to make sure it is being called, and then right after the BeginPlay received.
I have been using version control system since eons ago (svn,git)… but in this case, I needed to make changes across a lot of levels. But I am not sure about the outcome, and also the levels being backup already has some changes in it. So the easy way is to copy the file somewhere, revert the changes and do something on them.
I had the sama e issue and this was solution wow… No warnings, no errors nothing. Silly mistake, but some kind of info would have been great. Thanks for pointing this out (even though 4-year-old post).