Step by step how to collect objects to win game?

Hey guys! I have a blueprint actor that can be picked up, but can someone please take a moment to post maybe some pictures on how to tell the game to load the main menu level when the objects are collected, possibly with a win widget before? I’m a complete noob, ive got down the creative level design as i’m an artist, but these blueprints are not something I’ve got my head around fully.

Do you mean once you collect 10 orbs, for example, open a UI widget saying “You Win!” and then when you select the “okay” button you are taken back to the main menu?

say I wanted you to collect 10 of that object and win the level.

yes that’s pretty much it! all I have is the object as an actor that plays a sound when you pick it up and is destroyed and I have ten of them around the map. I don’t know how to make it a working system that wins the game

Ok, so first step, let’s get the UI widget up. Have you created the UI widget yet? If not, visit here and follow the steps. Creating and Displaying UI | Unreal Engine Documentation

Instead of dragging the text box to the middle, drag a button instead. If you can, drag text into the button and you can name the text to “You win!”.

Second step is triggering to make the UI widget appear. This is also pretty straighforward. Just go to the place in your code where you count everytime you pick up an object. Create a branch and count the number of objects you’ve collected. If that number is greater than or equal to 10 do this set of blueprinting.

Just the first picture. No need to do the Set in the middle. Just do the CREATE WIDGET and the ADD TO VIEWPORT.

By this point you should hopefully see the button appear when you collect 10 items.

The next step is to take an action when you press the button. Go back to the UI Widget blueprint you created. click on the button. On the right side you should see a “details tab” I believe is the name. Scroll down to the bottom and you should see a series of green buttons. Select the one that says “buttonClicked” or something similar (can’t remember the exact name right now). It should generate an event for you in your event graph. From there you just need to create a node called “openLevel”.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/OpenLevel/index.html

Inside the level name just put the name of the Level in your project. And that’s it!

If you select the button and its not loading, make sure you have the levelName exactly matching the name of the level file in your project explorer. For example, if I created a level called “mainMenu”, I would have to put “mainMenu” in for levelName.

Let me know if it works!

I’m gonna get to these and lll let you know thank you so much for helping!!

no problem! let me know if you run into any issues!

Okay so I’ve created the widget, now I’m just having trouble figuring out implementing the process of having the blueprint check how many I’ve collected in order to know when to display the widget. I’m sure it’s super simple and I’m just missing something

An easy way you can do it for now is go to the place where you play the sound when you pick up the object. Right before you call the destroy on the actor, do “get all actors of class” and look up on that class. If there is only one left, that means you just picked up the last one, so you can go ahead and display the widget then.