Click UMG Button to start fast day-night circle

hi there!
I want to create a menu button to start a fast day-night cirlce.
i have allready add a rotation timeline in my levelblueprint. (from this tutorial: Unreal Engine 4: Day night cycle using Blueprint. - YouTube)
When i start now the level, the time starts moving and the sun and light circles begin.

Can i trigger this special event by click on one Button? so that the circle starts not at the levelbeginning.

In your level BP, get all widgets and cast to your widget with button and get reference to that button. On this button’s onclicked event you can bind an event i.e. your time line.

Hope it helps !

~AB

hi again, ambhar :slight_smile: thanks!

ok i set it up, just like you did in your picture.
now i must bind an event in my menu widget BP to the button?!

but how can i “bind an event” from “onclicked event”, in my widget-BP?

From your button reference, drag a wire and type “assign on clicked” and select it, you will then get the nodes as the snapshot above.

ok, that works, but only for the first menu (the menu direct after the “game starts event”).
when i want to connect another widget-menu, than nothing happens.

it seems that the time-code in the levelblouprind works only for the very first beginning of the game?!

any idea?

I did not get what problem you are facing here. If you have more than one widget, then you need to follow same procedure for that too.

Ok.You can do one more thing.

Create your “BeginMenu” widget in BeginPlay event of your “GameMode”. In level BP start from the node marked green above. Add above nodes to Gamemode.

When you create beginmenu widget, store the return value into a variable e.g BeginMenu reference.

Go to your BeginMenu widget and then go to clicked event of button. Get reference to your gamemode “Get Gamemode” and get BeginMenureference. and remove it from viewport using “Remove from parent” node and after that node add your Menu widget in the viewport.

here a picture of my levelblueprint. when i change the “create menu widget class” from “BEGINMENU” (first menu of my game) (red circle), to “MENU” (second menu of my game) it works. But then this widget will load at the gamestart!
Buit I want to start the game with the BEGINMENU widget. After a buttonclick the “MENU” widget appear. From this widget i want to control the day-night-circle.

hi ambhar! thanks!
the first steps are done. but what do you mean with this:

“Go to your BeginMenu widget and then go to clicked event of button.”

what button do you mean?

“When you create beginmenu widget, store the return value into a variable e.g BeginMenu reference.”

ok i did it, but i think theres something wrong: (red circle) ?

You are using some SA button in your Menu widget as I can see in your screenshot above. When you go to your MENU widget and select that SA button, then you will find Events in the right sidebar where you have to select OnClicked event.

You are setting the variable wrong. We do it as the following screenshot :

58526-set+variable.png