Get All Actors of Class - Blueprints

I have a Game mode Blueprint which controls the logic for my game. In this Blueprint there is a “Get All actors of Class” which gets my max Score by finding all instances of “BP_Target”. When I click Play on that level (Level1) it works fine. However, When I start the game from my Main Menu and click play which just loads up “Level1”, the “Get All Actors of Class” Returns 0.
Blueprint Logic:


Main Menu Logic:
image
Main Menu World Game mode:

Any Ideas what I could be doing wrong?

Thanks.

Hey @Elliot1231234! Welcome to the forums!

So the problem is your “Game Logic” Event isn’t being called! It’s an event, but that event isn’t being told to do its thing! Ask yourself, why is it working outside of starting the level from the main menu, because even hitting play on Level 1… it shouldn’t work. :slight_smile:

So figure out why your score IS working, try a search in the bar at the bottom of the game mode screen and search the whole project for “GameLogic”. Maybe that will give you the clue you need!

Let us know how it goes!

​​Sorry I left it out of the screenshot I call it upon Event Begin Play
​​​​​​​​​​​
image

Ah! Okay. Let me show you a workaround. :slight_smile:

Put a delay between “GameLogic” and “GetAllActorsOfClass.”

Say… a delay node with a value of 0.2. If that doesn’t work try 0.8.

This SHOULD be easy, because I believe what is happening is the GameLogic is seeking out actors that haven’t loaded in yet! A little delay to let them get set up and it should be fine! (This is why loading screens exist :stuck_out_tongue: )

Yep, I added a 0.2s delay and now it is all working.

Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.